Skip to content

Conversation

@vstinner
Copy link
Member

@vstinner vstinner commented Jul 2, 2020

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().

https://bugs.python.org/issue41194

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().
@vstinner
Copy link
Member Author

vstinner commented Jul 2, 2020

This change doesn't fix https://bugs.python.org/issue41194 but only prepares the code for a fix.

@vstinner vstinner merged commit 74419f0 into python:master Jul 3, 2020
@vstinner vstinner deleted the ast_state branch July 3, 2020 09:35
vstinner added a commit that referenced this pull request Jul 3, 2020
…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 74419f0)

* 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 91e1bc1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants