File tree Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Expand file tree Collapse file tree 1 file changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -805,7 +805,6 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
805805 _Py_ClearExecutorDeletionList (interp );
806806#endif
807807 _PyAST_Fini (interp );
808- _PyWarnings_Fini (interp );
809808 _PyAtExit_Fini (interp );
810809
811810 // All Python types must be destroyed before the last GC collection. Python
@@ -815,6 +814,10 @@ interpreter_clear(PyInterpreterState *interp, PyThreadState *tstate)
815814 /* Last garbage collection on this interpreter */
816815 _PyGC_CollectNoFail (tstate );
817816 _PyGC_Fini (interp );
817+
818+ // Finalize warnings after last gc so that any finalizers can
819+ // access warnings state
820+ _PyWarnings_Fini (interp );
818821 struct _PyExecutorObject * cold = interp -> cold_executor ;
819822 if (cold != NULL ) {
820823 interp -> cold_executor = NULL ;
You can’t perform that action at this time.
0 commit comments