Plan Published for Riding CPython from Global Interpreter Blocking

Management Council of the Python announced about the intention to approve the proposal to expand the language Python PEP-0703, which determines the addition of the CPYTHON assembly mode without a global interpreter blocking (GIL, Global Interpreter Lock). As a probable period of implementation of the PEP-0703, the issue of Python 3.13, scheduled for the fall of next year, is mentioned.

In the introduced PEP-0703, the default GIL is determined, but adding the assembly option “–without-gil” to turn it off. The new mode will solve the problem with paralleling operations on multi-core systems, caused by the fact that global blocking does not allow parallel appeal to the separated objects from different flows. In the long run (after 5 years), the interpreter is planned to be transferred by default to the assembly only in mode without global blocking, while stopping the assembly with GIL.

At the first stage, the GIL shutdown by default is inappropriate due to overhead costs associated with changes in the garbage collector, memory management and primitives for the organization of locks. For example, due to the use of references for insulation of flows, a decrease in the performance of single-flow scenarios is observed (in the test set Pyperformance by 10%). In this case, the GIL shutdown may be required in scientific calculations for which the lack of parallelization is a more serious problem than the linear speed of the code.

It is noted that the work on caring from GIL will be carried out with great caution so as not to repeat the failure that happened when the Python 3 is promoted – the assembly without GIL will have to maintain reverse compatibility with the old versions of Python, and all the changes in the third-party code necessary to work in assemblies without GIL, they must also work in assembly with GIL. It is not planned to change the numbering of issues on Python 4 for assemblies without GIL, since compatibility at the ABI level will be preserved in them.

Until a full transition

/Reports, release notes, official announcements.