mirror of
https://github.com/python/cpython
synced 2026-11-06 09:02:40 +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
|
||
|---|---|---|
| .. | ||
| __init__.py | ||
| __main__.py | ||
| check_config.py | ||
| test_abstract.py | ||
| test_build.py | ||
| test_bytearray.py | ||
| test_bytes.py | ||
| test_capsule.py | ||
| test_codecs.py | ||
| test_complex.py | ||
| test_config.py | ||
| test_dict.py | ||
| test_emscripten.py | ||
| test_eval.py | ||
| test_eval_code_ex.py | ||
| test_exceptions.py | ||
| test_file.py | ||
| test_float.py | ||
| test_frame.py | ||
| test_function.py | ||
| test_getargs.py | ||
| test_hash.py | ||
| test_immortal.py | ||
| test_import.py | ||
| test_list.py | ||
| test_long.py | ||
| test_mem.py | ||
| test_misc.py | ||
| test_number.py | ||
| test_object.py | ||
| test_opt.py | ||
| test_pyatomic.py | ||
| test_run.py | ||
| test_set.py | ||
| test_slice.py | ||
| test_structmembers.py | ||
| test_sys.py | ||
| test_time.py | ||
| test_tuple.py | ||
| test_type.py | ||
| test_unicode.py | ||
| test_watchers.py | ||
| test_weakref.py | ||