mirror of
https://github.com/python/cpython.git
synced 2025-11-24 12:20:42 +00:00
gh-137384: fix crash when accessing warnings state late in runtime shutdown (#138027)
This commit is contained in:
parent
5b0f00e616
commit
b9bcd02e9f
3 changed files with 18 additions and 1 deletions
|
|
@ -805,7 +805,6 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
|
|||
_Py_ClearExecutorDeletionList(interp);
|
||||
#endif
|
||||
_PyAST_Fini(interp);
|
||||
_PyWarnings_Fini(interp);
|
||||
_PyAtExit_Fini(interp);
|
||||
|
||||
// All Python types must be destroyed before the last GC collection. Python
|
||||
|
|
@ -815,6 +814,10 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
|
|||
/* Last garbage collection on this interpreter */
|
||||
_PyGC_CollectNoFail(tstate);
|
||||
_PyGC_Fini(interp);
|
||||
|
||||
// Finalize warnings after last gc so that any finalizers can
|
||||
// access warnings state
|
||||
_PyWarnings_Fini(interp);
|
||||
struct _PyExecutorObject *cold = interp->cold_executor;
|
||||
if (cold != NULL) {
|
||||
interp->cold_executor = NULL;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue