aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Python/pystate.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/pystate.c')
-rw-r--r--Python/pystate.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/Python/pystate.c b/Python/pystate.c
index 975eb6d4fbd..3ceae229f75 100644
--- a/Python/pystate.c
+++ b/Python/pystate.c
@@ -1779,7 +1779,9 @@ tstate_delete_common(PyThreadState *tstate, int release_gil)
if (tstate->_status.bound_gilstate) {
unbind_gilstate_tstate(tstate);
}
- unbind_tstate(tstate);
+ if (tstate->_status.bound) {
+ unbind_tstate(tstate);
+ }
// XXX Move to PyThreadState_Clear()?
clear_datastack(tstate);