-
-
Notifications
You must be signed in to change notification settings - Fork 32.1k
gh-123344: Add missing ast optimizations for PEP 696 #123377
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -3090,16 +3090,16 @@ def assert_ast(self, code, non_optimized_target, optimized_target): | |||
f"{ast.dump(optimized_tree)}", | |||
) | |||
|
|||
def create_binop(self, operand, left=ast.Constant(1), right=ast.Constant(1)): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def create_binop(self, operand, left=ast.Constant(1), right=ast.Constant(1)): | |
def create_binop(self, operand, left=None, right=None): |
please, don't use complex objects as defaults
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems fine as is; it's more convenient to write many of the remaining tests this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am in a purist camp :) But, this is minor, I agree. Since these objects aren't ever mutated, this does not introduce any problems.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I also don't like mutable defaults. But this one looks not very complex and it doesn't seem to be mutated anytime soon :) We can rewrite it, but the diff would be much larger
Misc/NEWS.d/next/Core and Builtins/2024-08-27-13-16-40.gh-issue-123344.56Or78.rst
Outdated
Show resolved
Hide resolved
…e-123344.56Or78.rst Co-authored-by: Jelle Zijlstra <[email protected]>
Thanks @wrongnull for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13. |
…123377) (cherry picked from commit be083ce) Co-authored-by: Bogdan Romanyuk <[email protected]> Co-authored-by: Kirill Podoprigora <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
GH-123427 is a backport of this pull request to the 3.13 branch. |
… (#123427) (cherry picked from commit be083ce) Co-authored-by: Bogdan Romanyuk <[email protected]> Co-authored-by: Kirill Podoprigora <[email protected]> Co-authored-by: Jelle Zijlstra <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.