Anthony Shaw
tonybaloney.github.io โบ posts โบ sub-interpreter-web-workers.html
Running Python Parallel Applications with Sub Interpreters
November 17, 2023 - class SubinterpreterWorker(threading.Thread): def __init__(self, number: int, config: Config, sockets: Sockets): self.worker_number = number self.interp = interpreters.create() self.channel = channels.create() self.config = config # TODO copy other parameters from config self.sockets = sockets super().__init__(target=self.run, daemon=True) def run(self): # Convert insecure sockets to a tuple of tuples because the Sockets type cannot be shared insecure_sockets = [] for s in self.sockets.insecure_sockets: insecure_sockets.append((int(s.family), int(s.type), s.proto, s.fileno())) interpreters.run
Python 3.12 Preview: Subinterpreters โ Real Python
registation wall, can't read the article More on reddit.com
What are the differences between Python 3.12 sub-interpreters and multithreading/multiprocessing?
Basically yes. You can think of it as a more performant multiprocessing. Although the Python interface you mention will only be available in 3.13, for now it's strictly for the C API More on reddit.com
Expected performance characteristics of subinterpreters
Iโm testing the subinterpreters interface because Iโll likely be taking advantage of it to improve scaling of this library across multiple threads. Subinterpreters are attractive because: I need more flexible shared memory than multiprocessing can provide. More on discuss.python.org
Playing around sub-interpreters in 3.14
Hi - I thought that with the first class support for subinterpreters finally in the stdlib, my extrainterpreters pet project would be rendered all but obsolete. Nonetheless, I made a new release this week, changing just (and just) the importing names so that it could function with Python 3.14. More on discuss.python.org
Videos
Readthedocs
pythondev.readthedocs.io โบ subinterpreters.html
Python Subinterpreters โ Unofficial Python Development (Victor's notes) documentation
Effects of the EXPERIMENTAL_ISOLATED_SUBINTERPRETERS macro: Good things! Per-interpreter GIL!!! Use a TSS to get the current Python thread state (โtstateโ)
Python
peps.python.org โบ pep-0554
PEP 554 โ Multiple Interpreters in the Stdlib | peps.python.org
See the Examples section for concrete usage and use cases. Along with exposing the existing (in CPython) multiple interpreter support, the module will also support a basic mechanism for passing data between interpreters. That involves setting โshareableโ objects in the __main__ module of a target subinterpreter...
ThinhDA
thinhdanggroup.github.io โบ subinterpreter
Python 3.12 Subinterpreters: A New Era of Concurrency - ThinhDA
September 23, 2023 - On the other hand, each subinterpreter in Python has its own separate memory space, which can help to avoid these issues. However, this also means that sharing data between subinterpreters can be more complex. For example, subinterpreters can use the interpreters module to share data via channels, while threads can use the threading to share data via locks, queues, or other synchronization primitives.
Changs
blog.changs.co.uk โบ subinterpreters-and-asyncio.html
Subinterpreters and Asyncio - Jamie's Blog
August 5, 2025 - My solution for concurrency is almost always async, I've even made a similar case in Free Threaded Python With Asyncio. I am fully aware of how many people in the community dislike async. Unfortunately this is an opinion that could divide the community and is definitely a topic for another day. To marry subinterpreters with asyncio I created the package aiointerpreters. Here's a very basic example:
Python
peps.python.org โบ pep-0734
PEP 734 โ Multiple Interpreters in the Stdlib | peps.python.org
November 6, 2023 - In the case that code somewhere else may catch it, it is helpful to identify that the exception came from a subinterpreter (i.e. a โremoteโ source), rather than from the current interpreter. Thatโs why Interpreter.exec() raises ExecutionFailed and why it is a plain Exception, rather than a copy or proxy with a class that matches the original exception. For example, an uncaught ValueError from a subinterpreter would never get caught in a later try: ...
Reddit
reddit.com โบ r/python โบ what are the differences between python 3.12 sub-interpreters and multithreading/multiprocessing?
r/Python on Reddit: What are the differences between Python 3.12 sub-interpreters and multithreading/multiprocessing?
October 3, 2023 -
It seems like the new feature in Python 3.12 allows developers to create multiple sub-interpreters within a single main interpreter process. From the example from the PEP 554, sub-interpreters appear to be separate threads that run a dedicated piece of Python code and consequently have their own separate GILs.
interp = interpreters.create()
print('before')
interp.run('print("during")')
print('after')On practice, is this basically the new Pythonic way to run a single application in multiple threads and take advantage of multiple cores? If yes, can they be thought as multithreading with no shared state and become the future alternative of multiprocessing?
Top answer 1 of 6
60
Basically yes. You can think of it as a more performant multiprocessing. Although the Python interface you mention will only be available in 3.13, for now it's strictly for the C API
2 of 6
25
PEP 554 hasnโt been accepted and there is no interpreters module. The code that exists is C-API level only. Thereโs no Pythonic way to do it. The work accepted in 3.12 seems to be formalizing subinterpreters as a feature, where before it seemed somehow less official but still used by mod_wsgi.
Talk Python To Me
talkpython.fm โบ episodes โบ show โบ 447 โบ parallel-python-apps-with-sub-interpreters
Episode #447 - Parallel Python Apps with Sub Interpreters | Talk Python To Me Podcast
February 3, 2024 - Guests Anthony Shaw: @tonybaloney@fosstodon.org Eric Snow: @ericsnowcurrently@mastodon.social PEP 684 โ A Per-Interpreter GIL: peps.python.org PEP 734 โ Multiple Interpreters in the Stdlib: peps.python.org Running Python Parallel Applications with Sub Interpreters: fosstodon.org pytest subinterpreters: fosstodon.org Long-Term Vision for a Parallel Python Programming Model?: fosstodon.org Hypercorn Server: github.com msgspec: jcristharif.com Dill package: pypi.org Watch this episode on YouTube: youtube.com Episode #447 deep-dive: talkpython.fm/447 Episode transcripts: talkpython.fm ---== Don't be a stranger ==--- YouTube: youtube.com/@talkpython Bluesky: @talkpython.fm Mastodon: @talkpython@fosstodon.org X.com: @talkpython Michael on Bluesky: @mkennedy.codes Michael on Mastodon: @mkennedy@fosstodon.org Michael on X.com: @mkennedy
GitHub
github.com โบ Sleemanmunk โบ python_subinterpreters_example
GitHub - Sleemanmunk/python_subinterpreters_example: An example project of how to use subinterpreters in the lastest version of the Python C API without threads
An example project of how to use subinterpreters in the lastest version of the Python C API without threads - Sleemanmunk/python_subinterpreters_example
Author ย Sleemanmunk
LWN.net
lwn.net โบ Articles โบ 820424
Subinterpreters for Python [LWN.net]
May 13, 2020 - Eric Snow's PEP 554 ("Multiple Interpreters in the Stdlib") would expose the existing subinterpreter support from the C API in the standard library. That would allow Python programs to use multiple separate interpreters; the PEP also proposes to add a way to share some data types between the instances.
GitHub
github.com โบ jsbueno โบ extrainterpreters
GitHub - jsbueno/extrainterpreters: Utilities for using Python's PEP 554 subinterpreters
Still, at the eve of Python 3.14, I am issuing an small update so that the API as avaliable up to Python 3.13 is imported from the right place, and the structures in this project work. Just import "extrainterpreters" and use the Interpreter class as a wrapper to the subinterpreter represented by a single integer handle created by the new interpreters module:
Starred by 122 users
Forked by 8 users
Languages ย Python 96.8% | C 3.2% | Python 96.8% | C 3.2%
Vstinner
vstinner.github.io โบ cpython-pass-tstate.html
Pass the Python thread state explicitly โ Victor Stinner blog 3
January 8, 2020 - As explained above, another example is gilstate that should also be moved to PyInterpreterState, but that's a complex change that should be well prepared to not break anything. Implementing subinterpreters also requires to cleanup various parts of Python internals.
Readthedocs
anyio.readthedocs.io โบ en โบ latest โบ subinterpreters.html
Working with subinterpreters โ AnyIO 4.13.0.post2 documentation
Subinterpreters are only supported on Python 3.13 or later
Python.org
discuss.python.org โบ python help
Playing around sub-interpreters in 3.14 - Python Help - Discussions on Python.org
October 3, 2025 - Hi - I thought that with the first class support for subinterpreters finally in the stdlib, my extrainterpreters pet project would be rendered all but obsolete. Nonetheless, I made a new release this week, changing just (and just) the importing names so that it could function with Python 3.14.