mirror of
https://github.com/python/cpython.git
synced 2025-08-01 15:43:13 +00:00
bpo-41796: Call _PyAST_Fini() earlier to fix a leak (GH-23131)
Call _PyAST_Fini() on all interpreters, not only on the main interpreter. Also, call it ealier to fix a reference leak. Python types contain a reference to themselves in in their PyTypeObject.tp_mro member. _PyAST_Fini() must called before the last GC collection to destroy AST types. _PyInterpreterState_Clear() now calls _PyAST_Fini(). It now also calls _PyWarnings_Fini() on subinterpeters, not only on the main interpreter. Add an assertion in AST init_types() to ensure that the _ast module is no longer used after _PyAST_Fini() has been called.
This commit is contained in:
parent
212d32f45c
commit
fd957c124c
5 changed files with 78 additions and 43 deletions
|
@ -84,7 +84,7 @@ extern void _PyFaulthandler_Fini(void);
|
|||
extern void _PyHash_Fini(void);
|
||||
extern void _PyTraceMalloc_Fini(void);
|
||||
extern void _PyWarnings_Fini(PyInterpreterState *interp);
|
||||
extern void _PyAST_Fini(PyThreadState *tstate);
|
||||
extern void _PyAST_Fini(PyInterpreterState *interp);
|
||||
|
||||
extern PyStatus _PyGILState_Init(PyThreadState *tstate);
|
||||
extern void _PyGILState_Fini(PyThreadState *tstate);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue