Skip to content

Commit 47e51d7

Browse files
committed
Refactor interpreter cleanup
Move the cleanup logic into PyInterpreterState_Delete and remove the now-unused helper function.
1 parent e6ff33e commit 47e51d7

File tree

1 file changed

+3
-10
lines changed

1 file changed

+3
-10
lines changed

Python/pystate.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -485,20 +485,12 @@ free_interpreter(PyInterpreterState *interp)
485485
}
486486
}
487487

488-
static void
489-
cleanup_and_free_interpreter(PyInterpreterState *interp)
490-
{
491-
_Py_qsbr_fini(interp);
492-
_PyObject_FiniState(interp);
493-
free_interpreter(interp);
494-
}
495-
496488
static inline void
497489
release_interp_owner(PyInterpreterState *interp)
498490
{
499491
Py_ssize_t prev = _Py_atomic_add_ssize(&interp->owners, -1);
500492
if (prev == 1) {
501-
cleanup_and_free_interpreter(interp);
493+
free_interpreter(interp);
502494
}
503495
}
504496

@@ -974,7 +966,8 @@ PyInterpreterState_Delete(PyInterpreterState *interp)
974966
HEAD_UNLOCK(runtime);
975967

976968
interp->finalizing = 1;
977-
969+
_Py_qsbr_fini(interp);
970+
_PyObject_FiniState(interp);
978971
release_interp_owner(interp);
979972
}
980973

0 commit comments

Comments
 (0)