Race in PyUnicode_InternFromString under free-threading #128137
Labels
interpreter-core
(Objects, Python, Grammar, and Parser dirs)
topic-C-API
topic-free-threading
type-bug
An unexpected behavior, bug, or error
Bug report
Bug description:
Here's a race reported by thread sanitizer that I haven't been able to find a small reproducer for, but it does look racy reading the code.
I think the scenario here is:
intern_common
immortalizing the string, which sets the.interned
field on the string.kind
field.The
.kind
and.interned
fields are bitfields in the same word, so this is a race, and I can't see any synchronization or atomicity that would prevent it.Perhaps we need to hold the critical section on the intern dictionary longer, until immortalization is complete?
CPython versions tested on:
3.13
Operating systems tested on:
Linux
The text was updated successfully, but these errors were encountered: