gh-126914: Store the Preallocated Thread State's Pointer in a PyInterpreterState Field (gh-126989)

This approach eliminates the originally reported race. It also gets rid of the deadlock reported in gh-96071, so we can remove the workaround added then.
This commit is contained in:
Eric Snow 2024-11-19 12:59:19 -07:00 committed by GitHub
parent 824afbf548
commit 1c0a104eca
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 84 additions and 50 deletions

View file

@ -118,6 +118,9 @@ extern PyTypeObject _PyExc_MemoryError;
{ \
.id_refcount = -1, \
._whence = _PyInterpreterState_WHENCE_NOTSET, \
.threads = { \
.preallocated = &(INTERP)._initial_thread, \
}, \
.imports = IMPORTS_INIT, \
.ceval = { \
.recursion_limit = Py_DEFAULT_RECURSION_LIMIT, \