mirror of
https://github.com/python/cpython.git
synced 2025-11-13 15:40:05 +00:00
Reword paragraph on specific value for Py_LIMITED_API (GH-26101)
This commit is contained in:
parent
a09fc9c63f
commit
ddd30b2dd2
1 changed files with 10 additions and 10 deletions
|
|
@ -41,22 +41,22 @@ embedding Python.)
|
||||||
|
|
||||||
.. c:macro:: Py_LIMITED_API
|
.. c:macro:: Py_LIMITED_API
|
||||||
|
|
||||||
Define this macro ``Py_LIMITED_API`` before including ``Python.h`` to
|
Define this macro before including ``Python.h`` to opt in to only use
|
||||||
opt in to only use the Limited API.
|
the Limited API, and to select the Limited API version.
|
||||||
|
|
||||||
Defining ``Py_LIMITED_API`` to ``3`` will limit the available API so that
|
Define ``Py_LIMITED_API`` to the value of :c:data:`PY_VERSION_HEX`
|
||||||
the extension will work without recompilation with all Python 3.x releases
|
corresponding to the lowest Python version your extension supports.
|
||||||
(x>=2) on the particular :ref:`platform <stable-abi-platform>`.
|
The extension will work without recompilation with all Python 3 releases
|
||||||
|
from the specified one onward, and can use Limited API introduced up to that
|
||||||
|
version.
|
||||||
|
|
||||||
Defining ``Py_LIMITED_API`` to a value of :c:data:`PY_VERSION_HEX` will
|
|
||||||
limit the available API so that the extension will work without
|
|
||||||
recompilation with all Python 3 releases from the specified one.
|
|
||||||
This will allow using additional API introduced up to this version,
|
|
||||||
but the extension will lose compatibility with earlier Python versions.
|
|
||||||
Rather than using the ``PY_VERSION_HEX`` macro directly, hardcode a minimum
|
Rather than using the ``PY_VERSION_HEX`` macro directly, hardcode a minimum
|
||||||
minor version (e.g. ``0x030A0000`` for Python 3.10) for stability when
|
minor version (e.g. ``0x030A0000`` for Python 3.10) for stability when
|
||||||
compiling with future Python versions.
|
compiling with future Python versions.
|
||||||
|
|
||||||
|
You can also define ``Py_LIMITED_API`` to ``3``. This works the same as
|
||||||
|
``0x03020000`` (Python 3.2, the version that introduced Limited API).
|
||||||
|
|
||||||
On Windows, extensions that use the Stable ABI should be linked against
|
On Windows, extensions that use the Stable ABI should be linked against
|
||||||
``python3.dll`` rather than a version-specific library such as
|
``python3.dll`` rather than a version-specific library such as
|
||||||
``python39.dll``.
|
``python39.dll``.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue