@@ -41,22 +41,22 @@ embedding Python.)
41
41
42
42
.. c :macro :: Py_LIMITED_API
43
43
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
+
56
53
Rather than using the ``PY_VERSION_HEX `` macro directly, hardcode a minimum
57
54
minor version (e.g. ``0x030A0000 `` for Python 3.10) for stability when
58
55
compiling with future Python versions.
59
56
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
+
60
60
On Windows, extensions that use the Stable ABI should be linked against
61
61
``python3.dll `` rather than a version-specific library such as
62
62
``python39.dll ``.
0 commit comments