Python 3.12 Preview: Subinterpreters
Now that you know what a Python subinterpreter is, you’ll take a look at what’s changing in the upcoming releases of CPython.
Most of the subinterpreter changes are described in two proposals, PEP 684 and PEP 554. Only PEP 684 will make it into the 3.12 release. PEP 554 is scheduled for the 3.13 release but hasn’t been officially approved yet.
Changes to the Global State and the GIL
The main focus of PEP 684 is refactoring the internals of the CPython source code so that each subinterpreter can have its own global interpreter lock (GIL). The GIL is a lock, or mutex, which allows only one thread to have control of the Python interpreter. Until this PEP,