Skip to content

Commit ccbdd1f

Browse files
[3.15] gh-155504: Set the interpreter before fallible thread state initialization (GH-155590) (GH-155884)
(cherry picked from commit 94a75f7) Co-authored-by: Abdul Mohammad <154353563+abdulm5@users.noreply.github.com>
1 parent c437071 commit ccbdd1f

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+
Fix a crash when thread state creation fails before the thread state is fully
2+
initialized.

‎Python/pystate.c‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1479,6 +1479,8 @@ alloc_threadstate(PyInterpreterState *interp)
14791479
}
14801480
reset_threadstate(tstate);
14811481
}
1482+
// Set the interpreter before any later initialization can fail.
1483+
tstate->base.interp = interp;
14821484
return tstate;
14831485
}
14841486

0 commit comments

Comments
 (0)