diff options
author | Neil Schemenauer <nas-github@arctrix.com> | 2025-04-28 13:28:44 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2025-04-28 20:28:44 +0000 |
commit | e414a2d81c3e15553516979e146d9f258fb47b2e (patch) | |
tree | a3235722193c596e4188373416afb4412cdd6045 /Include/internal/pycore_interp_structs.h | |
parent | 22f0730d40c9534672f745f35cf876ad63d450bb (diff) | |
download | cpython-e414a2d81c3e15553516979e146d9f258fb47b2e.tar.gz cpython-e414a2d81c3e15553516979e146d9f258fb47b2e.zip |
gh-127266: avoid data races when updating type slots (gh-131174)
In the free-threaded build, avoid data races caused by updating type slots
or type flags after the type was initially created. For those (typically
rare) cases, use the stop-the-world mechanism. Remove the use of atomics
when reading or writing type flags. The use of atomics is not sufficient to
avoid races (since flags are sometimes read without a lock and without
atomics) and are no longer required.
Diffstat (limited to 'Include/internal/pycore_interp_structs.h')
-rw-r--r-- | Include/internal/pycore_interp_structs.h | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/Include/internal/pycore_interp_structs.h b/Include/internal/pycore_interp_structs.h index af6ee3ab489..f193fed1153 100644 --- a/Include/internal/pycore_interp_structs.h +++ b/Include/internal/pycore_interp_structs.h @@ -667,8 +667,11 @@ struct _Py_interp_cached_objects { /* object.__reduce__ */ PyObject *objreduce; +#ifndef Py_GIL_DISABLED + /* resolve_slotdups() */ PyObject *type_slots_pname; pytype_slotdef *type_slots_ptrs[MAX_EQUIV]; +#endif /* TypeVar and related types */ PyTypeObject *generic_type; |