8000 bpo-41194: Pass module state in Python-ast.c by vstinner · Pull Request #21284 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-41194: Pass module state in Python-ast.c #21284

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 3, 2020
Merged

bpo-41194: Pass module state in Python-ast.c #21284

merged 1 commit into from
Jul 3, 2020

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)
arun-mani-j pushed a commit to arun-mani-j/cpython that referenced this pull request Jul 21, 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().
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
0