]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-149716: Document PySlot_DATA for Py_mod_gil and Py_mod_multiple_interpreters ...
authorTaeknology <20297177+Taeknology@users.noreply.github.com>
Wed, 10 Jun 2026 10:10:15 +0000 (19:10 +0900)
committerGitHub <noreply@github.com>
Wed, 10 Jun 2026 10:10:15 +0000 (12:10 +0200)
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.

Doc/c-api/module.rst

index 20fd66e35a0d4d611f4e7a9d48cf4363b20fd3a9..9f68abba66bc5d655d2abea947f6b7cc3e93fb55 100644 (file)
@@ -247,6 +247,15 @@ Feature slots
    If ``Py_mod_multiple_interpreters`` is not specified, the import
    machinery defaults to ``Py_MOD_MULTIPLE_INTERPRETERS_SUPPORTED``.
 
+   For historical reasons, the values are declared as pointers (``void *``).
+   When using :c:type:`PySlot` arrays, use :c:macro:`PySlot_DATA` for
+   :c:macro:`!Py_mod_multiple_interpreters`:
+
+   .. code-block:: c
+
+      PySlot_DATA(Py_mod_multiple_interpreters,
+                  Py_MOD_PER_INTERPRETER_GIL_SUPPORTED)
+
    .. versionadded:: 3.12
 
 .. c:macro:: Py_mod_gil
@@ -272,6 +281,14 @@ Feature slots
    If ``Py_mod_gil`` is not specified, the import machinery defaults to
    ``Py_MOD_GIL_USED``.
 
+   For historical reasons, the values are declared as pointers (``void *``).
+   When using :c:type:`PySlot` arrays, use :c:macro:`PySlot_DATA` for
+   :c:macro:`!Py_mod_gil`:
+
+   .. code-block:: c
+
+      PySlot_DATA(Py_mod_gil, Py_MOD_GIL_NOT_USED)
+
    .. versionadded:: 3.13