diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2023-07-31 23:15:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-07-31 23:15:13 (GMT) |
commit | 3f6afafa7e7294786913dbecf79fe42c8b510f85 (patch) | |
tree | 99d254a33ae9aa3c445e173b7a8ed7835584ef1c /Doc/c-api | |
parent | fd6085529935afec085cea0729507ba6d4b34ab3 (diff) | |
download | cpython-3f6afafa7e7294786913dbecf79fe42c8b510f85.zip cpython-3f6afafa7e7294786913dbecf79fe42c8b510f85.tar.gz cpython-3f6afafa7e7294786913dbecf79fe42c8b510f85.tar.bz2 |
[3.12] gh-107306: Add a Doc Entry for Py_mod_multiple_interpreters (GH-107403) (gh-107521)
gh-107306: Add a Doc Entry for Py_mod_multiple_interpreters (GH-107403)
It was added in 3.12 for PEP 684 (per-interpreter GIL).
(cherry picked from commit fb344e99aa0da5bef9318684ade69978585fe060)
Co-authored-by: Eric Snow <ericsnowcurrently@gmail.com>
Diffstat (limited to 'Doc/c-api')
-rw-r--r-- | Doc/c-api/init.rst | 1 | ||||
-rw-r--r-- | Doc/c-api/module.rst | 31 |
2 files changed, 32 insertions, 0 deletions
diff --git a/Doc/c-api/init.rst b/Doc/c-api/init.rst index 52824b6..8b960b0 100644 --- a/Doc/c-api/init.rst +++ b/Doc/c-api/init.rst @@ -1555,6 +1555,7 @@ function. You can create and destroy them using the following functions: in any thread where the sub-interpreter is currently active. Otherwise only multi-phase init extension modules (see :pep:`489`) may be imported. + (Also see :c:macro:`Py_mod_multiple_interpreters`.) This must be ``1`` (non-zero) if :c:member:`~PyInterpreterConfig.use_main_obmalloc` is ``0``. diff --git a/Doc/c-api/module.rst b/Doc/c-api/module.rst index 8ca48c8..2b6875d 100644 --- a/Doc/c-api/module.rst +++ b/Doc/c-api/module.rst @@ -376,6 +376,37 @@ The available slot types are: If multiple ``Py_mod_exec`` slots are specified, they are processed in the order they appear in the *m_slots* array. +.. c:macro:: Py_mod_multiple_interpreters + + Specifies one of the following values: + + .. c:macro:: Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED + + The module does not support being imported in subinterpreters. + + .. c:macro:: Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED + + The module supports being imported in subinterpreters, + but only when they share the main interpreter's GIL. + (See :ref:`isolating-extensions-howto`.) + + .. c:macro:: Py_MOD_PER_INTERPRETER_GIL_SUPPORTED + + The module supports being imported in subinterpreters, + even when they have their own GIL. + (See :ref:`isolating-extensions-howto`.) + + This slot determines whether or not importing this module + in a subinterpreter will fail. + + Multiple ``Py_mod_multiple_interpreters`` slots may not be specified + in one module definition. + + If ``Py_mod_multiple_interpreters`` is not specified, the import + machinery defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_NOT_SUPPORTED``. + + .. versionadded:: 3.12 + See :PEP:`489` for more details on multi-phase initialization. Low-level module creation functions |