Skip to content

Allow Subinterpreters on WASI/Emscripten Builds #135190

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

Open
ericsnowcurrently opened this issue Jun 5, 2025 · 4 comments
Open

Allow Subinterpreters on WASI/Emscripten Builds #135190

ericsnowcurrently opened this issue Jun 5, 2025 · 4 comments
Labels
3.14 bugs and security fixes 3.15 new features, bugs and security fixes docs Documentation in the Doc dir interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-emscripten OS-wasi stdlib Python modules in the Lib dir tests Tests in the Lib/test dir topic-subinterpreters

Comments

@ericsnowcurrently
Copy link
Member

Currently using multiple interpreters on WASI and Emscripten builds is disallowed. This is reflected in various places, including configure, the test suite, and the docs. I don't recall why the feature was disallowed (maybe confusion about a relationship with threads?), but there shouldn't be any need to disallow them.

CC @brettcannon

@ericsnowcurrently ericsnowcurrently added tests Tests in the Lib/test dir docs Documentation in the Doc dir interpreter-core (Objects, Python, Grammar, and Parser dirs) stdlib Python modules in the Lib dir topic-subinterpreters OS-wasi labels Jun 5, 2025
@ericsnowcurrently ericsnowcurrently added 3.14 bugs and security fixes OS-emscripten 3.15 new features, bugs and security fixes labels Jun 5, 2025
@brettcannon
Copy link
Member

Do the tests require processes for any reason? Otherwise I don't remember explicitly turning them off.

@freakboy3742
Copy link
Contributor

@hoodmane can confirm, but IIRC, on Emscripten, the restriction is the lack of threads (or, at least, the decision to disable the limited thread support that is available on Emscripten because of security and compatibility concerns).

@hoodmane
Copy link
Contributor

hoodmane commented Jun 5, 2025

Yeah, threads don't work very well with dynamic linking on Emscripten. I think as long as you first load dynamic libraries, then start threads it's probably okay. But it's complex to support and I don't personally care enough. Subinterpreters don't seem like they can be all that useful without threading.

@ZeroIntensity
Copy link
Member

There are definitely some use cases for subinterpreters outside concurrency. There's some discussion surrounding this on the PEP 734 acceptance yesterday. I think the clearest one is that you can change sys.path to allow conflicting versions of dependencies to be loaded in the same process.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.14 bugs and security fixes 3.15 new features, bugs and security fixes docs Documentation in the Doc dir interpreter-core (Objects, Python, Grammar, and Parser dirs) OS-emscripten OS-wasi stdlib Python modules in the Lib dir tests Tests in the Lib/test dir topic-subinterpreters
Projects
Status: Todo
Status: Todo
Development

No branches or pull requests

5 participants