mirror of
https://github.com/python/cpython
synced 2026-09-29 12:10:30 +03:00
bpo-41631: _ast module uses again a global state (#21961)
Partially revert commit ac46eb4ad6:
"bpo-38113: Update the Python-ast.c generator to PEP384 (gh-15957)".
Using a module state per module instance is causing subtle practical
problems.
For example, the Mercurial project replaces the __import__() function
to implement lazy import, whereas Python expected that "import _ast"
always return a fully initialized _ast module.
Add _PyAST_Fini() to clear the state at exit.
The _ast module has no state (set _astmodule.m_size to 0). Remove
astmodule_traverse(), astmodule_clear() and astmodule_free()
functions.
This commit is contained in:
parent
7bcc6456ad
commit
e5fbe0cbd4
7 changed files with 162 additions and 311 deletions
|
|
@ -84,6 +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 PyStatus _PyGILState_Init(PyThreadState *tstate);
|
||||
extern void _PyGILState_Fini(PyThreadState *tstate);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue