You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Make xml.etree.ElementTree.Element usable on free-threaded builds #146022
Descriptino _elementtree.c declares Py_MOD_GIL_NOT_USED but has zero @critical_section annotations. element_getitem() checks self->extra != NULL then dereferences self->extra->children[index], but with no lock between the check and the use. Concurrent elem.clear() sets self->extra = NULL and frees the children array between those two operations, causing a NULL dereference.
I am not entirely sure that ElementreTree is actually safe under free-threading. We did add some locks here and there but I don't recall having used critical sections when I fixed UAFs.
changed the title [-]xml.etree.ElementTree.Element crashes (SIGSEGV) under concurrent clear() and subscript access in free-threading builds[/-][+]Make `xml.etree.ElementTree.Element` usable on free-threaded builds[/+]on Mar 16, 2026
FTR: I don't want an LLM doing those changes. I want a core developer doing them or someone that has contributed enough to CPython because the implementation is non-trivial.
Activity
picnixz commentedon Mar 16, 2026
I am not entirely sure that ElementreTree is actually safe under free-threading. We did add some locks here and there but I don't recall having used critical sections when I fixed UAFs.
[-]xml.etree.ElementTree.Element crashes (SIGSEGV) under concurrent clear() and subscript access in free-threading builds[/-][+]Make `xml.etree.ElementTree.Element` usable on free-threaded builds[/+]picnixz commentedon Mar 16, 2026
FTR: I don't want an LLM doing those changes. I want a core developer doing them or someone that has contributed enough to CPython because the implementation is non-trivial.