mirror of
https://github.com/python/cpython
synced 2026-10-30 08:11:56 +03:00
Setting __name__, __qualname__, __doc__ or __module__ on a function
stopped the world in the free-threaded build since gh-154826 and
gh-154851, making functools.wraps() orders of magnitude slower with
multiple threads.
Use the per-object critical section and _PyObject_XSetRefDelayed()
instead, as gen_set_name() already does. Use acquire loads in the
readers and hold strong references across error reporting, tracing, and
eval-frame recording that may execute Python or detach the thread. The
__code__, __defaults__, __kwdefaults__ and __closure__ setters still
stop the world to clear func_version.
Document synchronization requirements for direct field access and the
lifetime of borrowed function attributes.
(cherry picked from commit
|
||
|---|---|---|
| .. | ||
| abstract.h | ||
| audit.h | ||
| bytearrayobject.h | ||
| bytesobject.h | ||
| cellobject.h | ||
| ceval.h | ||
| classobject.h | ||
| code.h | ||
| compile.h | ||
| complexobject.h | ||
| context.h | ||
| critical_section.h | ||
| descrobject.h | ||
| dictobject.h | ||
| fileobject.h | ||
| fileutils.h | ||
| floatobject.h | ||
| frameobject.h | ||
| funcobject.h | ||
| genobject.h | ||
| import.h | ||
| initconfig.h | ||
| listobject.h | ||
| longintrepr.h | ||
| longobject.h | ||
| marshal.h | ||
| memoryobject.h | ||
| methodobject.h | ||
| modsupport.h | ||
| monitoring.h | ||
| object.h | ||
| objimpl.h | ||
| odictobject.h | ||
| picklebufobject.h | ||
| pthread_stubs.h | ||
| pyatomic.h | ||
| pyatomic_gcc.h | ||
| pyatomic_msc.h | ||
| pyatomic_std.h | ||
| pyctype.h | ||
| pydebug.h | ||
| pyerrors.h | ||
| pyfpe.h | ||
| pyframe.h | ||
| pyhash.h | ||
| pylifecycle.h | ||
| pylock.h | ||
| pymem.h | ||
| pystate.h | ||
| pystats.h | ||
| pythonrun.h | ||
| pythread.h | ||
| pytime.h | ||
| sentinelobject.h | ||
| setobject.h | ||
| sliceobject.h | ||
| structseq.h | ||
| traceback.h | ||
| tracemalloc.h | ||
| tupleobject.h | ||
| unicodeobject.h | ||
| warnings.h | ||
| weakrefobject.h | ||