Content-Length: 331945 | pFad | https://github.com/python/cpython/issues/104621

CE Subinterpreters can load modules without subinterpreter support · Issue #104621 · python/cpython · GitHub
Skip to content

Subinterpreters can load modules without subinterpreter support #104621

@brandtbucher

Description

@brandtbucher

The first time a subinterpreter attempts to import a module without proper subinterpreter support, an ImportError is raised (which is correct). However, subsequent imports of the same module succeed!

Using readline as an example, since it's currently single-phase init:

>>> from _xxsubinterpreters import create, run_string
>>> s = "import readline; print(readline)"
>>> interp = create()
>>> run_string(interp, s)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
_xxsubinterpreters.RunFailedError: <class 'ImportError'>: module readline does not support loading in subinterpreters
>>> run_string(interp, s)
<module 'readline'>

Linked PRs

Metadata

Metadata

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions









    ApplySandwichStrip

    pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


    --- a PPN by Garber Painting Akron. With Image Size Reduction included!

    Fetched URL: https://github.com/python/cpython/issues/104621

    Alternative Proxies:

    Alternative Proxy

    pFad Proxy

    pFad v3 Proxy

    pFad v4 Proxy