cpython/Lib/test/test_free_threading
Neil Schemenauer be5386f03f
[3.14] gh-159136: Avoid stop-the-world when setting function name attributes (gh-159269) (gh-159726)
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 010bebbf9f)
2026-10-30 11:03:31 -07:00
..
__init__.py
test_bisect.py
test_bytes_object.py [3.14] gh-158803: Fix crash in bytes.join() on a concurrently mutated list (#159031) 2026-10-09 11:43:05 +02:00
test_capi.py [3.14] Use _testlimitedcapi in test_free_threading.test_capi (GH-158935) (GH-159146) (#159147) 2026-10-10 21:24:48 +00:00
test_code.py
test_collections.py
test_context.py [3.14] gh-155519: fix data-race for Context.ctx_vars (GH-155522) (#155892) 2026-08-20 15:21:09 +05:30
test_cprofile.py
test_csv.py
test_datetime.py [3.14] gh-159458: Fix free-threading data race in datetime strftime century normalization (GH-159520) (gh-159537) 2026-10-20 11:58:22 -07:00
test_dbm_gnu.py
test_dict.py [3.14] gh-160496: Clear inline values with atomic release stores (GH-160510) (#160709) 2026-10-26 14:46:27 +00:00
test_dict_watcher.py
test_enumerate.py
test_exceptions.py
test_frame.py
test_func_annotations.py
test_functions.py [3.14] gh-159136: Avoid stop-the-world when setting function name attributes (gh-159269) (gh-159726) 2026-10-30 11:03:31 -07:00
test_functools.py
test_gc.py [3.14] gh-149816: #96 Fix a race condition in invoke_gc_callback with free threading (GH-150029) (GH-156119) (#159310) 2026-10-20 17:42:26 -07:00
test_grp.py
test_heapq.py
test_io.py [3.14] gh-157364: Fix use-after-free in io.TextIOWrapper during reentrant detach (#159600) 2026-10-16 23:53:10 +00:00
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 [3.14] gh-158121: Preserve instruction events when line monitoring is… (#159741) 2026-10-19 14:19:52 -07:00
test_os.py [3.14] gh-158893: Make os.strerror() thread-safe (#159120) (#159145) 2026-10-10 20:54:38 +00:00
test_pickle.py
test_races.py [3.14] gh-159293: Restore the recursion limit after the free-threading race test (GH-159311) (#159390) 2026-10-14 12:46:59 +00:00
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 [3.14] gh-149816: Fix race in subtype_getweakref in free-threading build (gh-150247) (gh-159363) 2026-10-13 11:34:43 -07:00
test_zip.py