PyType_AddWatcher
and friends are not thread safe in free-threading
#131544
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
topic-free-threading
type-bug
An unexpected behavior, bug, or error
PyType_AddWatcher
andPyType_ClearWatcher
are not thread safe as it modifies the interp's type watchers non-atomically.PyType_AddWatcher
:cpython/Objects/typeobject.c
Lines 949 to 963 in d3f6063
PyType_ClearWatcher
:cpython/Objects/typeobject.c
Lines 980 to 989 in d3f6063
I think adding and removing of type watchers is a rare event so maybe instead of adding atomics or locks it would be better to change them to use stop-the-world pause event.
The text was updated successfully, but these errors were encountered: