Skip to content

Commit 11c93d6

Browse files
authored
gh-149716: Document PySlot_DATA for Py_mod_gil and Py_mod_multiple_interpreters (GH-150053)
Add short code examples mirroring the existing Py_mod_abi example, so it is clear which slot definition macro (PySlot_DATA, PySlot_INT64, or PySlot_UINT64) to use for these two slots.
1 parent 7a014f4 commit 11c93d6

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

Doc/c-api/module.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -247,6 +247,15 @@ Feature slots
247247
If ``Py_mod_multiple_interpreters`` is not specified, the import
248248
machinery defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``.
249249
250+
For historical reasons, the values are declared as pointers (``void *``).
251+
When using :c:type:`PySlot` arrays, use :c:macro:`PySlot_DATA` for
252+
:c:macro:`!Py_mod_multiple_interpreters`:
253+
254+
.. code-block:: c
255+
256+
PySlot_DATA(Py_mod_multiple_interpreters,
257+
Py_MOD_PER_INTERPRETER_GIL_SUPPORTED)
258+
250259
.. versionadded:: 3.12
251260
252261
.. c:macro:: Py_mod_gil
@@ -272,6 +281,14 @@ Feature slots
272281
If ``Py_mod_gil`` is not specified, the import machinery defaults to
273282
``Py_MOD_GIL_USED``.
274283
284+
For historical reasons, the values are declared as pointers (``void *``).
285+
When using :c:type:`PySlot` arrays, use :c:macro:`PySlot_DATA` for
286+
:c:macro:`!Py_mod_gil`:
287+
288+
.. code-block:: c
289+
290+
PySlot_DATA(Py_mod_gil, Py_MOD_GIL_NOT_USED)
291+
275292
.. versionadded:: 3.13
276293
277294

0 commit comments

Comments
 (0)