Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
gh-127274: Defer nested methods#128012
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
Methods (functions defined in class scope) are likely to be cleanedup by the GC anyway.Add a new code flag, `CO_METHOD`, that is set for functions definedin a class scope. Use that when deciding to defer functions.
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.
LGTM
Uh oh!
There was an error while loading.Please reload this page.
The other |
Should that be done for |
Wasn't aware of that flag, but if we also added that one recently, then yes. |
MacOS-13 build failure looks like an issue with homebrew that is unrelated to this PR. |
@JelleZijlstra - would you please have another look? |
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.
Could also add tests that look directly at the flags of a code object, but flags are documented as internal and an implementation detail and CO_HAS_DOCSTRINGS doesn't have tests either, so I think it's fine not to test this.
255762c intopython:mainUh oh!
There was an error while loading.Please reload this page.
Methods (functions defined in class scope) are likely to be cleanedup by the GC anyway.Add a new code flag, `CO_METHOD`, that is set for functions definedin a class scope. Use that when deciding to defer functions.
Methods (functions defined in class scope) are likely to be cleanedup by the GC anyway.Add a new code flag, `CO_METHOD`, that is set for functions definedin a class scope. Use that when deciding to defer functions.
Uh oh!
There was an error while loading.Please reload this page.
Methods (functions defined in class scope) are likely to be cleaned up by the GC anyway, so deferring nested methods will not prolong their lifetime.
Add a new code flag,
CO_METHOD, that is set for functions defined in a class scope. Use that when deciding to defer functions.