mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
[3.9] bpo-41631: _ast module uses again a global state (GH-21961) (GH-22258)
Partially revert commitac46eb4ad6
: "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.. (cherry picked from commite5fbe0cbd4
) Co-authored-by: Victor Stinner <vstinner@python.org>
This commit is contained in:
parent
0cc037f8a7
commit
55e0836849
7 changed files with 157 additions and 311 deletions
|
@ -1255,6 +1255,7 @@ finalize_interp_types(PyThreadState *tstate, int is_main_interp)
|
|||
{
|
||||
if (is_main_interp) {
|
||||
/* Sundry finalizers */
|
||||
_PyAST_Fini();
|
||||
_PyFrame_Fini();
|
||||
_PyTuple_Fini();
|
||||
_PyList_Fini();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue