mirror of
https://github.com/python/cpython.git
synced 2025-08-22 17:55:18 +00:00
gh-127274: Defer nested methods (#128012)
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.
This commit is contained in:
parent
e163e8d4e1
commit
255762c09f
11 changed files with 37 additions and 14 deletions
|
@ -1289,6 +1289,8 @@ compute_code_flags(compiler *c)
|
|||
flags |= CO_VARKEYWORDS;
|
||||
if (ste->ste_has_docstring)
|
||||
flags |= CO_HAS_DOCSTRING;
|
||||
if (ste->ste_method)
|
||||
flags |= CO_METHOD;
|
||||
}
|
||||
|
||||
if (ste->ste_coroutine && !ste->ste_generator) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue