mirror of
https://github.com/python/cpython
synced 2026-11-15 05:58:13 +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 | ||
| test_bisect.py | ||
| test_bytes_object.py | ||
| test_capi.py | ||
| test_code.py | ||
| test_collections.py | ||
| test_context.py | ||
| test_cprofile.py | ||
| test_csv.py | ||
| test_datetime.py | ||
| test_dbm_gnu.py | ||
| test_dict.py | ||
| test_dict_watcher.py | ||
| test_enumerate.py | ||
| test_exceptions.py | ||
| test_frame.py | ||
| test_func_annotations.py | ||
| test_functions.py | ||
| test_functools.py | ||
| test_gc.py | ||
| test_grp.py | ||
| test_heapq.py | ||
| test_io.py | ||
| test_iteration.py | ||
| test_itertools.py | ||
| test_itertools_batched.py | ||
| test_itertools_combinatoric.py | ||
| test_list.py | ||
| test_methodcaller.py | ||
| test_mmap.py | ||
| test_monitoring.py | ||
| test_os.py | ||
| test_pickle.py | ||
| test_races.py | ||
| test_re.py | ||
| test_resource.py | ||
| test_reversed.py | ||
| test_set.py | ||
| test_slots.py | ||
| test_str.py | ||
| test_string_template_race.py | ||
| test_sys.py | ||
| test_threading.py | ||
| test_tokenize.py | ||
| test_type.py | ||
| test_types.py | ||
| test_uuid.py | ||
| test_weakref.py | ||
| test_zip.py | ||