@@ -20,9 +20,9 @@ but will need to be compiled separately for 3.9.x and 3.10.x.
2020
2121There are two tiers of C API with different stability exepectations:
2222
23- - * Unstable API * , may change in minor versions without a deprecation period.
24- It is marked by the ``PyUnstable `` prefix in names.
25- - * Limited API * , is compatible across several minor releases.
23+ - :ref: ` Unstable API < unstable-c-api >` , may change in minor versions without
24+ a deprecation period. It is marked by the ``PyUnstable `` prefix in names.
25+ - :ref: ` Limited API < limited-c-api >` , is compatible across several minor releases.
2626 When :c:macro: `Py_LIMITED_API ` is defined, only this subset is exposed
2727 from ``Python.h ``.
2828
@@ -55,19 +55,19 @@ CPython development and spend extra effort adjusting to changes.
5555Stable Application Binary Interface
5656===================================
5757
58+ For simplicity, this document talks about *extensions *, but the Limited API
59+ and Stable ABI work the same way for all uses of the API – for example,
60+ embedding Python.
61+
62+ .. _limited-c-api :
63+
64+ Limited C API
65+ -------------
66+
5867Python 3.2 introduced the *Limited API *, a subset of Python's C API.
5968Extensions that only use the Limited API can be
6069compiled once and work with multiple versions of Python.
61- Contents of the Limited API are :ref: `listed below <stable-abi-list >`.
62-
63- To enable this, Python provides a *Stable ABI *: a set of symbols that will
64- remain compatible across Python 3.x versions. The Stable ABI contains symbols
65- exposed in the Limited API, but also other ones – for example, functions
66- necessary to support older versions of the Limited API.
67-
68- (For simplicity, this document talks about *extensions *, but the Limited API
69- and Stable ABI work the same way for all uses of the API – for example,
70- embedding Python.)
70+ Contents of the Limited API are :ref: `listed below <limited-api-list >`.
7171
7272.. c :macro :: Py_LIMITED_API
7373
@@ -87,6 +87,19 @@ embedding Python.)
8787 You can also define ``Py_LIMITED_API `` to ``3 ``. This works the same as
8888 ``0x03020000 `` (Python 3.2, the version that introduced Limited API).
8989
90+
91+ .. _stable-abi :
92+
93+ Stable ABI
94+ ----------
95+
96+ To enable this, Python provides a *Stable ABI *: a set of symbols that will
97+ remain compatible across Python 3.x versions.
98+
99+ The Stable ABI contains symbols exposed in the :ref: `Limited API
100+ <limited-c-api>`, but also other ones – for example, functions necessary to
101+ support older versions of the Limited API.
102+
90103On Windows, extensions that use the Stable ABI should be linked against
91104``python3.dll `` rather than a version-specific library such as
92105``python39.dll ``.
@@ -131,9 +144,9 @@ Limited API Caveats
131144-------------------
132145
133146Note that compiling with ``Py_LIMITED_API `` is *not * a complete guarantee that
134- code conforms to the Limited API or the Stable ABI. `` Py_LIMITED_API `` only
135- covers definitions, but an API also includes other issues, such as expected
136- semantics.
147+ code conforms to the :ref: ` Limited API < limited-c-api >` or the :ref: ` Stable ABI
148+ <stable-abi>`. `` Py_LIMITED_API `` only covers definitions, but an API also
149+ includes other issues, such as expected semantics.
137150
138151One issue that ``Py_LIMITED_API `` does not guard against is calling a function
139152with arguments that are invalid in a lower Python version.
@@ -166,9 +179,9 @@ Platform Considerations
166179=======================
167180
168181ABI stability depends not only on Python, but also on the compiler used,
169- lower-level libraries and compiler options. For the purposes of the Stable ABI,
170- these details define a “platform”. They usually depend on the OS
171- type and processor architecture
182+ lower-level libraries and compiler options. For the purposes of
183+ the :ref: ` Stable ABI < stable-abi >`, these details define a “platform”. They
184+ usually depend on the OS type and processor architecture
172185
173186It is the responsibility of each particular distributor of Python
174187to ensure that all Python versions on a particular platform are built
@@ -177,12 +190,12 @@ This is the case with Windows and macOS releases from ``python.org`` and many
177190third-party distributors.
178191
179192
180- .. _ stable-abi -list :
193+ .. _ limited-api -list :
181194
182195Contents of Limited API
183196=======================
184197
185198
186- Currently, the Limited API includes the following items:
199+ Currently, the :ref: ` Limited API < limited-c-api >` includes the following items:
187200
188201.. limited-api-list ::
0 commit comments