diff options
author | mpage <mpage@meta.com> | 2024-12-19 21:03:14 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-12-19 21:03:14 (GMT) |
commit | 255762c09fe518757bb3e8ce1bb6e5d8eec9f466 (patch) | |
tree | 179d8f0893a0550d2f73359da6e20d4df05e01e2 /Doc/library | |
parent | e163e8d4e1a9844b8615ef38b9917b887a377948 (diff) | |
download | cpython-255762c09fe518757bb3e8ce1bb6e5d8eec9f466.zip cpython-255762c09fe518757bb3e8ce1bb6e5d8eec9f466.tar.gz cpython-255762c09fe518757bb3e8ce1bb6e5d8eec9f466.tar.bz2 |
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.
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/inspect.rst | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Doc/library/inspect.rst b/Doc/library/inspect.rst index ca5dac8..0085207 100644 --- a/Doc/library/inspect.rst +++ b/Doc/library/inspect.rst @@ -1708,6 +1708,13 @@ which is a bitmap of the following flags: .. versionadded:: 3.14 +.. data:: CO_METHOD + + The flag is set when the code object is a function defined in class + scope. + + .. versionadded:: 3.14 + .. note:: The flags are specific to CPython, and may not be defined in other Python implementations. Furthermore, the flags are an implementation |