Skip to content

Commit 9d47a7b

Browse files
committed
Add comment and NEWS for thread state cleanup fix
1 parent 7a02891 commit 9d47a7b

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Fixed a possible crash in free-threaded builds when interpreter creation fails
2+
due to memory allocation failure.

Python/pystate.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1661,6 +1661,8 @@ new_threadstate(PyInterpreterState *interp, int whence)
16611661
if (tstate == NULL) {
16621662
return NULL;
16631663
}
1664+
// Set the back-pointer before init_threadstate() so early cleanup can
1665+
// recognize the preallocated initial thread state after allocation failures.
16641666
tstate->base.interp = interp;
16651667

16661668
#ifdef Py_GIL_DISABLED

0 commit comments

Comments
 (0)