Skip to content

Commit 5abc681

Browse files
Reword paragraph on specific value for Py_LIMITED_API (GH-26101) (GH-26123)
(cherry picked from commit ddd30b2) Co-authored-by: Petr Viktorin <[email protected]>
1 parent f28bac4 commit 5abc681

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

Doc/c-api/stable.rst

+12-12
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,22 @@ embedding Python.)
4141

4242
.. c:macro:: Py_LIMITED_API
4343
44-
Define this macro ``Py_LIMITED_API`` before including ``Python.h`` to
45-
opt in to only use the Limited API.
46-
47-
Defining ``Py_LIMITED_API`` to ``3`` will limit the available API so that
48-
the extension will work without recompilation with all Python 3.x releases
49-
(x>=2) on the particular :ref:`platform <stable-abi-platform>`.
50-
51-
Defining ``Py_LIMITED_API`` to a value of :c:data:`PY_VERSION_HEX` will
52-
limit the available API so that the extension will work without
53-
recompilation with all Python 3 releases from the specified one.
54-
This will allow using additional API introduced up to this version,
55-
but the extension will lose compatibility with earlier Python versions.
44+
Define this macro before including ``Python.h`` to opt in to only use
45+
the Limited API, and to select the Limited API version.
46+
47+
Define ``Py_LIMITED_API`` to the value of :c:data:`PY_VERSION_HEX`
48+
corresponding to the lowest Python version your extension supports.
49+
The extension will work without recompilation with all Python 3 releases
50+
from the specified one onward, and can use Limited API introduced up to that
51+
version.
52+
5653
Rather than using the ``PY_VERSION_HEX`` macro directly, hardcode a minimum
5754
minor version (e.g. ``0x030A0000`` for Python 3.10) for stability when
5855
compiling with future Python versions.
5956

57+
You can also define ``Py_LIMITED_API`` to ``3``. This works the same as
58+
``0x03020000`` (Python 3.2, the version that introduced Limited API).
59+
6060
On Windows, extensions that use the Stable ABI should be linked against
6161
``python3.dll`` rather than a version-specific library such as
6262
``python39.dll``.

0 commit comments

Comments
 (0)