-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Defer functions defined in nested classes in free-threaded builds #127274
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
Labels
Comments
mpage
added a commit
to mpage/cpython
that referenced
this issue
Dec 18, 2024
mpage
added a commit
to mpage/cpython
that referenced
this issue
Dec 19, 2024
mpage
added a commit
that referenced
this issue
Dec 19, 2024
Methods (functions defined in class scope) are likely to be cleaned up by the GC anyway. Add a new code flag, `CO_METHOD`, that is set for functions defined in a class scope. Use that when deciding to defer functions.
srinivasreddy
pushed a commit
to srinivasreddy/cpython
that referenced
this issue
Dec 23, 2024
Methods (functions defined in class scope) are likely to be cleaned up by the GC anyway. Add a new code flag, `CO_METHOD`, that is set for functions defined in a class scope. Use that when deciding to defer functions.
I suspect this can be closed, @mpage. |
srinivasreddy
pushed a commit
to srinivasreddy/cpython
that referenced
this issue
Jan 8, 2025
Methods (functions defined in class scope) are likely to be cleaned up by the GC anyway. Add a new code flag, `CO_METHOD`, that is set for functions defined in a class scope. Use that when deciding to defer functions.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Feature or enhancement
Proposal:
We currently only defer functions that do not have the
CO_NESTED
flag set:cpython/Objects/funcobject.c
Lines 213 to 218 in 26ff32b
This also excludes functions defined on nested classes. In the example below, the
Foo.__init__
function will not use deferred reference counting because the__init__
method's code object has theCO_NESTED
flag set.We would like to relax the restriction on
CO_NESTED
to allow functions that are defined on nested classes to use deferred reference counting.Has this already been discussed elsewhere?
This is a minor feature, which does not need previous discussion elsewhere
Links to previous discussion of this feature:
No response
Linked PRs
The text was updated successfully, but these errors were encountered: