gh-122666: Tests for ast optimizations#122667
Conversation
|
Hypothesis failure looks unrelated. |
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
vstinner
left a comment
There was a problem hiding this comment.
I proposed to write "Lines below are generated by running (...)" into a separated file, not move eval_opt_tests into a separated file. Would it be possible?
| print("]") | ||
| print("main()") | ||
| raise SystemExit | ||
| unittest.main() |
There was a problem hiding this comment.
This line is no longer needed since there's no unittest in snippets.py
vstinner
left a comment
There was a problem hiding this comment.
LGTM.
@JelleZijlstra: Do you want to review this change?
JelleZijlstra
left a comment
There was a problem hiding this comment.
There are a few more optimizations this doesn't test. We could keep them for another PR if you want to, but they don't seem difficult to test:
not (a is b)->a is not bnot (a in b)->a not in b(1,) * 3->(1, 1, 1)- It seems that in some cases it changes
%formatting into f-strings but I haven't been able to trigger that __debug__gets turned into True or False
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
This is already tested by |
|
@JelleZijlstra do you think it's worth backporting this to the 3.13 branch? |
|
Yes, it's good to backport new tests in general so we can be more confident in bugfixes. |
|
Thanks @Eclips4 for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
(cherry picked from commit 9f9b00d) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
|
GH-123359 is a backport of this pull request to the 3.13 branch. |
Oh, I forgot about 3.12 branch. I think it's also ok to backport it to 3.12. What do you think? |
|
We can't because the |
Oh, yeah, you're right. I agree that it's not worth the effort. |
(cherry picked from commit 9f9b00d) Co-authored-by: Kirill Podoprigora <kirill.bast9@mail.ru> Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com> Co-authored-by: Victor Stinner <vstinner@python.org> Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Uh oh!
There was an error while loading. Please reload this page.