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 Answer from Yoghurt42 on reddit.com
ThinhDA
thinhdanggroup.github.io › subinterpreter
Python 3.12 Subinterpreters: A New Era of Concurrency - ThinhDA
September 23, 2023 - This blog post will introduce you to the exciting new feature in Python 3.12 - Subinterpreters. We’ll start by explaining what subinterpreters are, their history, and how they compare to threads, processes, and greenlets. From there, we’ll delve into why subinterpreters were introduced, discussing the limitations of the Global Interpreter Lock (GIL) and how subinterpreters can improve performance and concurrency in Python.
GitHub
github.com › ChillFish8 › python12-subinterpreters
GitHub - ChillFish8/python12-subinterpreters: Some simple and hopefully safe-ish bindings to Python 3.12's sub-interpreters.
Some simple and hopefully safe-ish bindings to Python 3.12's sub-interpreters. - ChillFish8/python12-subinterpreters
Author ChillFish8
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
Legacy-mode subinterpreters in Python 3.12: `import _tkinter` leads to shutdown crash
Bug report Bug description: Hello everyone, I am working on an application embedding multiple Python subinterpreters - for which the Python version should be upgraded from Python 3.10 to Python 3.12.1. For the time being, the "legacy ver... More on github.com
Support for creating python sub-interpreters
One of the most exciting features of Python 3.12 is the possibility of creating sub-interpreters programmatically, each with an independent per-interpreter lock. This feature relies on a new C API ... More on github.com
Independent SubInterpreters are still not concurrent with python 3.12+
I've removed any functions call even functions like sum(). It seems like SubInterpreter creations and even function starts are concurrent, but overall it's still synchronized on something (despite the fact that python 3.12+ should support per-interpreter GIL). More on github.com
Videos
27:47
Python in Parallel: Sub-Interpreters vs. NoGIL vs. Multiprocessing ...
Talks - Anthony Shaw: Unlocking the Parallel Universe ...
31:42
[PyCon APAC 2023] Parallel code with Python 3.12 sub-interpreters ...
09:18
Multithreading is possible in Python 3.12 ( with speed test ) - ...
GitHub
github.com › jsbueno › extrainterpreters
GitHub - jsbueno/extrainterpreters: Utilities for using Python's PEP 554 subinterpreters
This was made available in 2023 as Python 3.12 came out to allow some experiments and sending objects back and forth subinterpreters.
Starred by 122 users
Forked by 8 users
Languages Python 96.8% | C 3.2% | Python 96.8% | C 3.2%
Real Python
realpython.com › python312-subinterpreters
Python 3.12 Preview: Subinterpreters – Real Python
May 3, 2024 - Free Bonus: Click here to download your sample code for a sneak peek at Python 3.12, coming in October 2023. Before you start thinking about subinterpreters, recall that an interpreter is a program that executes a script directly in a high-level language instead of translating it to machine code.
Readthedocs
pythondev.readthedocs.io › subinterpreters.html
Python Subinterpreters — Unofficial Python Development (Victor's notes) documentation
_xxsubinterpreters.run_string(): release the GIL: https://github.com/python/cpython/commit/fb2c7c4afbab0514352ab0246b0c0cc85d1bba53 · subprocess: close_fds=False, posix_spawn() is safe in subinterpreters
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.
GitHub
github.com › python › cpython › issues › 115649
Legacy-mode subinterpreters in Python 3.12: `import _tkinter` leads to shutdown crash · Issue #115649 · python/cpython
February 19, 2024 - For the time being, the "legacy version" of subinterpreters (i.e., using a global, shared GIL) should be used, since all Python extensions (including _tkinter and all extensions with single-phase initialization) should be supported. If I understand the docs correctly, using the legacy Py_NewInterpreter() method should preserve the existing behavior. Still, the following application crashes at shutdown: #include <Python.h> class PythonInterpreter { public: PythonInterpreter(PyThreadState* parent, int id) : mParent(parent) , mId(id) { PyEval_RestoreThread(mParent); mThread = Py_NewInterpreter();
Author car-bianco
GitHub
github.com › pythonnet › pythonnet › issues › 2333
Support for creating python sub-interpreters · Issue #2333 · pythonnet/pythonnet
February 29, 2024 - One of the most exciting features of Python 3.12 is the possibility of creating sub-interpreters programmatically, each with an independent per-interpreter lock. This feature relies on a new C API function Py_NewInterpreterFromConfig. Ne...
Author glopesdev
GitHub
github.com › ninia › jep › issues › 593
Independent SubInterpreters are still not concurrent with python 3.12+ · Issue #593 · ninia/jep
January 23, 2025 - I've removed any functions call even functions like sum(). It seems like SubInterpreter creations and even function starts are concurrent, but overall it's still synchronized on something (despite the fact that python 3.12+ should support per-interpreter GIL).
Author novos40
GitHub
github.com › faster-cpython › ideas › blob › main › 3.13 › README.md
ideas/3.13/README.md at main · faster-cpython/ideas
Enabling subinterpreters from Python code (PEP 554). ... See Tier 2 optimizer for an explanation of what the tier2 optimizer is. ... Our goal for 3.13 is to reduce the time spent in the interpreter by at least 50%. Issue. Execution engine. Detailed plan for copy-and-patch. Unlike the other tasks, which are mainly focused on single-threaded performance, this work builds on the per-interpreter GIL work that shipped in Python 3.12 to allow Python programmers to take advantage of better parallelism in subinterpreters from Python code (without the need to write a C extension).
Author faster-cpython
GitHub
github.com › faster-cpython › ideas › wiki › Python-3.12-Goals
Python 3.12 Goals · faster-cpython/ideas Wiki
March 3, 2023 - Additionally, PEP 554 will make it possible to create subinterpreters from Python (currently a C API-only feature), opening up true multi-threaded parallelism. We have done an analysis of which bytecodes would benefit the most from specialization ...
Author faster-cpython
Martin Heinz
martinheinz.dev › blog › 97
Real Multithreading is Coming to Python - Learn How You Can Use It Now | Martin Heinz | Personal Website & Blog
May 14, 2023 - We've found the sub-interpreters, but we will also need to borrow some helper functions from Python's test module that we will use to pass code to sub-interpreter: from textwrap import dedent import os # https://github.com/python/cpython/blob/ # 15665d896bae9c3d8b60bd7210ac1b7dc533b093/Lib/test/test__xxsubinterpreters.py#L75 def _captured_script(script): r, w = os.pipe() indented = script.replace('\n', '\n ') wrapped = dedent(f""" import contextlib with open({w}, 'w', encoding="utf-8") as spipe: with contextlib.redirect_stdout(spipe): {indented} """) return wrapped, open(r, encoding="utf-8") def _run_output(interp, request, channels=None): script, rpipe = _captured_script(request) with rpipe: interp.run(script, channels=channels) return rpipe.read()
GitHub
github.com › python › cpython › blob › main › Doc › whatsnew › 3.12.rst
cpython/Doc/whatsnew/3.12.rst at main · python/cpython
If you know the tp_new can be skipped safely, filter the deprecation warning out using :func:`warnings.catch_warnings` from Python. :c:var:`PyOS_InputHook` and :c:var:`PyOS_ReadlineFunctionPointer` are no longer called in :ref:`subinterpreters <sub-interpreter-support>`. This is because clients generally rely on process-wide global state (since these callbacks have no way of recovering extension module state).
Author python
Vstinner
vstinner.github.io › isolate-subinterpreters.html
Isolate Python Subinterpreters — Victor Stinner blog 3
December 27, 2020 - It should ease the development of isolated subinterpreters. It will be removed once subinterpreters will be fully isolated (once each interpreter will have its own GIL). Types declared in Python (class MyType: ...) are always "heap types": types dynamically allocated on the heap memory.
Stack Overflow
stackoverflow.com › questions › 78766850 › are-python-3-12-subinterpreters-multi-cpu
Are Python 3.12 subinterpreters multi-CPU? - Stack Overflow
Python 3.12 exposes the subinterpreter functionality: after starting the Python main.exe you can spawn multiple subinterpreter threads. Questions: As the subinterpreter threads run in the same pro...
Python documentation
docs.python.org › 3 › whatsnew › 3.12.html
What's New In Python 3.12 — Python 3.14.3 documentation
February 23, 2026 - syslog.openlog() and syslog.closelog() now fail if used in subinterpreters. syslog.syslog() may still be used in subinterpreters, but now only if syslog.openlog() has already been called in the main interpreter. These new restrictions do not apply to the main interpreter, so only a very small set of users might be affected.