@@ -25,19 +25,19 @@ are private API that can change without notice even in patch releases.
2525Stable Application Binary Interface
2626===================================
2727
28+ For simplicity, this document talks about *extensions *, but the Limited API
29+ and Stable ABI work the same way for all uses of the API – for example,
30+ embedding Python.
31+
32+ .. _limited-c-api :
33+
34+ Limited C API
35+ -------------
36+
2837Python 3.2 introduced the *Limited API *, a subset of Python's C API.
2938Extensions that only use the Limited API can be
3039compiled once and work with multiple versions of Python.
31- Contents of the Limited API are :ref: `listed below <stable-abi-list >`.
32-
33- To enable this, Python provides a *Stable ABI *: a set of symbols that will
34- remain compatible across Python 3.x versions. The Stable ABI contains symbols
35- exposed in the Limited API, but also other ones – for example, functions
36- necessary to support older versions of the Limited API.
37-
38- (For simplicity, this document talks about *extensions *, but the Limited API
39- and Stable ABI work the same way for all uses of the API – for example,
40- embedding Python.)
40+ Contents of the Limited API are :ref: `listed below <limited-api-list >`.
4141
4242.. c :macro :: Py_LIMITED_API
4343
@@ -57,6 +57,19 @@ embedding Python.)
5757 You can also define ``Py_LIMITED_API `` to ``3 ``. This works the same as
5858 ``0x03020000 `` (Python 3.2, the version that introduced Limited API).
5959
60+
61+ .. _stable-abi :
62+
63+ Stable ABI
64+ ----------
65+
66+ To enable this, Python provides a *Stable ABI *: a set of symbols that will
67+ remain compatible across Python 3.x versions.
68+
69+ The Stable ABI contains symbols exposed in the :ref: `Limited API
70+ <limited-c-api>`, but also other ones – for example, functions necessary to
71+ support older versions of the Limited API.
72+
6073On Windows, extensions that use the Stable ABI should be linked against
6174``python3.dll `` rather than a version-specific library such as
6275``python39.dll ``.
@@ -101,9 +114,9 @@ Limited API Caveats
101114-------------------
102115
103116Note that compiling with ``Py_LIMITED_API `` is *not * a complete guarantee that
104- code conforms to the Limited API or the Stable ABI. `` Py_LIMITED_API `` only
105- covers definitions, but an API also includes other issues, such as expected
106- semantics.
117+ code conforms to the :ref: ` Limited API < limited-c-api >` or the :ref: ` Stable ABI
118+ <stable-abi>`. `` Py_LIMITED_API `` only covers definitions, but an API also
119+ includes other issues, such as expected semantics.
107120
108121One issue that ``Py_LIMITED_API `` does not guard against is calling a function
109122with arguments that are invalid in a lower Python version.
@@ -136,9 +149,9 @@ Platform Considerations
136149=======================
137150
138151ABI stability depends not only on Python, but also on the compiler used,
139- lower-level libraries and compiler options. For the purposes of the Stable ABI,
140- these details define a “platform”. They usually depend on the OS
141- type and processor architecture
152+ lower-level libraries and compiler options. For the purposes of
153+ the :ref: ` Stable ABI < stable-abi >`, these details define a “platform”. They
154+ usually depend on the OS type and processor architecture
142155
143156It is the responsibility of each particular distributor of Python
144157to ensure that all Python versions on a particular platform are built
@@ -147,12 +160,12 @@ This is the case with Windows and macOS releases from ``python.org`` and many
147160third-party distributors.
148161
149162
150- .. _ stable-abi -list :
163+ .. _ limited-api -list :
151164
152165Contents of Limited API
153166=======================
154167
155168
156- Currently, the Limited API includes the following items:
169+ Currently, the :ref: ` Limited API < limited-c-api >` includes the following items:
157170
158171.. limited-api-list ::
0 commit comments