cpython/Parser
Pablo Galindo 55e0836849
[3.9] bpo-41631: _ast module uses again a global state (GH-21961) (GH-22258)
Partially revert commit ac46eb4ad6662cf6d771b20d8963658b2186c48c:
"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 commit e5fbe0cbd4)

Co-authored-by: Victor Stinner <vstinner@python.org>
2020-09-15 20:32:56 +02:00
..
pegen
pgen
Python.asdl
acceler.c
asdl.py
asdl_c.py [3.9] bpo-41631: _ast module uses again a global state (GH-21961) (GH-22258) 2020-09-15 20:32:56 +02:00
grammar1.c
listnode.c
myreadline.c
node.c
parser.c
parser.h
parsetok.c
token.c
tokenizer.c
tokenizer.h