mirror of
https://github.com/python/cpython.git
synced 2025-08-24 02:35:59 +00:00
bpo-46417: Clear symtable identifiers at exit (GH-30809)
Add _PySymtable_Fini() function, called by finalize_interp_clear(). Update test_cmd_line.test_showrefcount() to tolerate negative reference count.
This commit is contained in:
parent
1ded8ed8e8
commit
12f4ac3bc8
4 changed files with 25 additions and 3 deletions
|
@ -23,6 +23,7 @@
|
|||
#include "pycore_runtime_init.h" // _PyRuntimeState_INIT
|
||||
#include "pycore_sliceobject.h" // _PySlice_Fini()
|
||||
#include "pycore_structseq.h" // _PyStructSequence_InitState()
|
||||
#include "pycore_symtable.h" // _PySymtable_Fini()
|
||||
#include "pycore_sysmodule.h" // _PySys_ClearAuditHooks()
|
||||
#include "pycore_traceback.h" // _Py_DumpTracebackThreads()
|
||||
#include "pycore_tuple.h" // _PyTuple_InitTypes()
|
||||
|
@ -1700,6 +1701,9 @@ finalize_interp_clear(PyThreadState *tstate)
|
|||
int is_main_interp = _Py_IsMainInterpreter(tstate->interp);
|
||||
|
||||
_PyExc_ClearExceptionGroupType(tstate->interp);
|
||||
if (is_main_interp) {
|
||||
_PySymtable_Fini();
|
||||
}
|
||||
|
||||
/* Clear interpreter state and all thread states */
|
||||
_PyInterpreterState_Clear(tstate);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue