@@ -70,6 +70,10 @@ New grammar features:
7070
7171* :pep: `701 `: Syntactic formalization of f-strings
7272
73+ Interpreter improvements:
74+
75+ * :ref: `whatsnew312-pep684 `
76+
7377New typing features:
7478
7579* :pep: `688 `: Making the buffer protocol accessible in Python
@@ -277,6 +281,36 @@ The new :class:`inspect.BufferFlags` enum represents the flags that
277281can be used to customize buffer creation.
278282(Contributed by Jelle Zijlstra in :gh: `102500 `.)
279283
284+ .. _whatsnew312-pep684 :
285+
286+ PEP 684: A Per-Interpreter GIL
287+ ------------------------------
288+
289+ Sub-interpreters may now be created with a unique GIL per interpreter.
290+ This allows Python programs to take full advantage of multiple CPU
291+ cores.
292+
293+ Use the new :c:func: `Py_NewInterpreterFromConfig ` function to
294+ create an interpreter with its own GIL::
295+
296+ PyInterpreterConfig config = {
297+ .check_multi_interp_extensions = 1,
298+ .gil = PyInterpreterConfig_OWN_GIL,
299+ };
300+ PyThreadState *tstate = NULL;
301+ PyStatus status = Py_NewInterpreterFromConfig(&tstate, &config);
302+ if (PyStatus_Exception(status)) {
303+ return -1;
304+ }
305+ /* The new interpeter is now active in the current thread. */
306+
307+ For further examples how to use the C-API for sub-interpreters with a
308+ per-interpreter GIL, see :source: `Modules/_xxsubinterpretersmodule.c `.
309+
310+ A Python API is anticipated for 3.13. (See :pep: `554 `.)
311+
312+ (Contributed by Eric Snow in :gh: `104210 `, etc.)
313+
280314New Features Related to Type Hints
281315==================================
282316
@@ -1744,6 +1778,12 @@ New Features
17441778
17451779 (Contributed by Eddie Elizondo in :gh: `84436 `.)
17461780
1781+ * :pep: `684 `: Added the new :c:func: `Py_NewInterpreterFromConfig `
1782+ function and :c:type: `PyInterpreterConfig `, which may be used
1783+ to create sub-interpreters with their own GILs.
1784+ (See :ref: `whatsnew312-pep684 ` for more info.)
1785+ (Contributed by Eric Snow in :gh: `104110 `.)
1786+
17471787* In the limited C API version 3.12, :c:func: `Py_INCREF ` and
17481788 :c:func: `Py_DECREF ` functions are now implemented as opaque function calls to
17491789 hide implementation details.
0 commit comments