Data race on tp_flags
with subinterpreters and static types
#129817
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
topic-free-threading
topic-subinterpreters
type-bug
An unexpected behavior, bug, or error
Bug report
I saw this in the free threading build when running
test_concurrent_futures.test_interpreter_pool
. I suspect it affects the default build (with per-interpreter GIL) as well, but I haven't verified that.The fix looks straightforward to me: only set
Py_TPFLAGS_READY
ifinitial
is true. Otherwise, the type will already havePy_TPFLAGS_READY
set.Write of
tp_flags
:cpython/Objects/typeobject.c
Lines 8661 to 8663 in fbaa6c8
Read of
tp_flags
:cpython/Objects/typeobject.c
Lines 392 to 402 in fbaa6c8
Linked PRs
_PyType_HasFeature()
to check tp_flags. #130892The text was updated successfully, but these errors were encountered: