[3.9] bpo-41194: The _ast module cannot be loaded more than once (GH-21290) (GH-21292)

* bpo-41194: Pass module state in Python-ast.c (GH-21284)

Rework asdl_c.py to pass the module state to functions in
Python-ast.c, instead of using astmodulestate_global.

Handle also PyState_AddModule() failure in init_types().

(cherry picked from commit 74419f0c64)

* bpo-41194: The _ast module cannot be loaded more than once (GH-21290)

Fix a crash in the _ast module: it can no longer be loaded more than
once. It now uses a global state rather than a module state.

* Move _ast module state: use a global state instead.
* Set _astmodule.m_size to -1, so the extension cannot be loaded more
  than once.

(cherry picked from commit 91e1bc18bd)
This commit is contained in:
Victor Stinner 2020-07-03 16:57:19 +02:00 committed by GitHub
parent 486c256bdf
commit f8599279b6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 2093 additions and 2182 deletions

4066
Python/Python-ast.c generated

File diff suppressed because it is too large Load diff