We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6f19384 commit b702da2Copy full SHA for b702da2
1 file changed
Python/pystate.c
@@ -2789,19 +2789,17 @@ PyGILState_Ensure(void)
2789
assert(tcur->gilstate_counter == 1);
2790
tcur->gilstate_counter = 0;
2791
has_gil = 0; /* new thread state is never current */
2792
+ PyInterpreterRef_Close(ref);
2793
}
2794
else {
2795
has_gil = holds_gil(tcur);
2796
2797
2798
if (!has_gil) {
2799
+ // XXX Do we need to protect this against finalization?
2800
PyEval_RestoreThread(tcur);
2801
2802
- if (tcur == NULL) {
- PyInterpreterRef_Close(ref);
2803
- }
2804
-
2805
/* Update our counter in the thread-state - no need for locks:
2806
- tcur will remain valid as we hold the GIL.
2807
- the counter is safe as we are the only thread "allowed"
0 commit comments