Skip to content

Commit 53fa94b

Browse files
committed
Don't try to clear owned_guard in PyThreadState_Clear().
1 parent adb985f commit 53fa94b

1 file changed

Lines changed: 1 addition & 5 deletions

File tree

Python/pystate.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1865,7 +1865,6 @@ PyThreadState_Clear(PyThreadState *tstate)
18651865
#endif
18661866

18671867
tstate->_status.cleared = 1;
1868-
tstate->ensure.owned_guard = NULL;
18691868

18701869
// XXX Call _PyThreadStateSwap(runtime, NULL) here if "current".
18711870
// XXX Do it as early in the function as possible.
@@ -3575,10 +3574,7 @@ PyThreadState_Release(PyThreadStateToken *token)
35753574
PyThreadState_Clear(tstate);
35763575
--tstate->ensure.counter;
35773576
}
3578-
3579-
// This is usually done by PyThreadState_Clear(), but we need to do it
3580-
// manually if we don't own the thread state.
3581-
if (owned_guard != NULL) {
3577+
else if (owned_guard != NULL) {
35823578
tstate->ensure.owned_guard = NULL;
35833579
}
35843580

0 commit comments

Comments
 (0)