-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
gh-130080: implement PEP 765 #130087
gh-130080: implement PEP 765 #130087
Conversation
iritkatriel
commented
Feb 13, 2025
•
edited
Loading
edited
- Issue: Implement PEP 765 #130080
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.
Looks good, but I'm not sure I entirely trust the overwrite/save/overwrite logic.
Saving, overwriting and then overwriting again seems an error prone way to maintain a stack of the current context. ControlFlowInFinallyState
can fit in a single byte and the depth of try-finally is limited to 20 (CO_MAXBLOCKS) so a stack will only take 20 bytes or so.
When you're done making the requested changes, leave the comment: |
I have made the requested changes; please review again. |
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.
Looks good in general.
The two uses of CO_MAXBLOCKS
differ, so will need to be aligned.
Could also use a test or two for deeply nested functions with loops and try-finallys.
When you're done making the requested changes, leave the comment: |
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 noticed I had some pending comments which I forgot to send.. 😄
Co-authored-by: Tomas R. <tomas.roun8@gmail.com>
I have made the requested changes; please review again. |
Thanks for making the requested changes! @markshannon: please review the changes made to this pull request. |
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.
There are two unused fields in _PyASTOptimizeState
that need removing, otherwise looks good.
Python/ast_opt.c
Outdated
int optimize; | ||
int ff_features; | ||
int syntax_check_only; | ||
|
||
int recursion_depth; /* current recursion depth */ |
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 doesn't appear to be used anywhere (same for recursion_limit
)
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.
Thanks. I think they were removed in the const folding PRs after I created this one.
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.
Just some docs comments.
@@ -68,6 +68,7 @@ Summary -- release highlights | |||
* :ref:`PEP 741: Python Configuration C API <whatsnew314-pep741>` | |||
* :ref:`PEP 761: Discontinuation of PGP signatures <whatsnew314-pep761>` | |||
* :ref:`A new type of interpreter <whatsnew314-tail-call>` | |||
* :ref:`PEP 765: Disallow return/break/continue that exit a finally block <whatsnew314-pep765>` |
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.
For the reader, I think it may be better to have the PEP bullet points grouped.
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>
Co-authored-by: Bénédikt Tran <10796600+picnixz@users.noreply.github.com>