mirror of
https://github.com/python/cpython.git
synced 2025-10-25 02:43:41 +00:00
[3.14] gh-137384: fix crash when accessing warnings state late in runtime shutdown (GH-138027) (#138065)
This commit is contained in:
parent
c213eb90a0
commit
d619015ecd
3 changed files with 17 additions and 1 deletions
|
|
@ -914,7 +914,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
|
||||
|
|
@ -925,6 +924,9 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
|
|||
_PyGC_CollectNoFail(tstate);
|
||||
_PyGC_Fini(interp);
|
||||
|
||||
// Finalize warnings after last gc so that any finalizers can
|
||||
// access warnings state
|
||||
_PyWarnings_Fini(interp);
|
||||
/* We don't clear sysdict and builtins until the end of this function.
|
||||
Because clearing other attributes can execute arbitrary Python code
|
||||
which requires sysdict and builtins. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue