[New-bugs-announce] [issue41796] _ast module state should be made per interpreter

STINNER Victor report at bugs.python.org
Wed Sep 16 06:10:24 EDT 2020


New submission from STINNER Victor <vstinner at python.org>:

In September 2019, the _ast extension module was converted to PEP 384 (stable ABI): bpo-38113.

In bpo-41631, I moved the _ast module state back to a global state, rather than a regular module state, to fix multiple bugs.

The state should be made per intepreter (moved into PyInterpreterState).

Also, each interpreter should have its own _ast types (_ast.AST, _ast.Constant, etc.), rather than sharing all types.

Hopefully, in 3.9, _ast types have been converted to heap types.

To fix bpo-41631, I wanted to convert _ast.AST heap type back into a static type, to prevenet a subinterpreter to modify it, but Petr Viktorin asked me to leave it as it is:
https://github.com/python/cpython/pull/21961#issuecomment-685821519

I agree since I would like to convert all static types to heap types: bpo-40077.

----------
components: Interpreter Core
messages: 376983
nosy: vstinner
priority: normal
severity: normal
status: open
title: _ast module state should be made per interpreter
versions: Python 3.10

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41796>
_______________________________________


More information about the New-bugs-announce mailing list