Skip to content

Commit 5232fda

Browse files
encukouAA-Turner
andauthored
PEP 689: Rename to "Unstable C API tier" (#2576)
Co-authored-by: Adam Turner <[email protected]>
1 parent f1be4a3 commit 5232fda

File tree

1 file changed

+28
-26
lines changed

1 file changed

+28
-26
lines changed

pep-0689.rst

Lines changed: 28 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
PEP: 689
2-
Title: Semi-stable C API tier
2+
Title: Unstable C API tier
33
Author: Petr Viktorin <[email protected]>
44
Status: Draft
55
Type: Standards Track
@@ -13,7 +13,7 @@ Post-History: `27-Apr-2022 <https://mail.python.org/archives/list/python-dev@pyt
1313
Abstract
1414
========
1515

16-
Some functions and types of the C-API are designated *semi-stable*,
16+
Some functions and types of the C-API are designated *unstable*,
1717
meaning that they will not change in patch (bugfix/security) releases,
1818
but may change between minor releases (e.g. between 3.11 and 3.12) without
1919
deprecation warnings.
@@ -29,9 +29,12 @@ The Python C-API is currently divided into `three tiers <https://devguide.python
2929
<387>`, and requires deprecation warnings before changes
3030
- Private (internal) API, which can change at any time.
3131

32-
We need a tier between Public and Private to accommodate tools like
33-
advanced debuggers and JIT compilers, which need access to CPython
34-
internals but assume the C-API they use does not change in patch releases.
32+
Tools requring access to CPython internals (e.g. advanced
33+
debuggers and JIT compilers) are often built for minor series releases
34+
of CPython, and assume that the C-API internals used do not change
35+
in patch releases. To support these tools, we need a tier between the
36+
Public and Private C-API, with guarantees on stability throughout
37+
the minor-series release.
3538

3639

3740
Setting Stability Expectations
@@ -49,7 +52,7 @@ in patch releases:
4952
- Patch releases only contain bugfixes, which are unlikely to
5053
change the API.
5154

52-
Semi-stable API will make the stability expectations more explicit.
55+
Unstable API will make the stability expectations more explicit.
5356

5457
It will also hopefully encourage existing users of the private API to
5558
reach out to python-dev, so we can expose, standardize and test an API
@@ -70,16 +73,17 @@ convention are unlikely to check if underscored functions they are
7073
changing are documented and used outside CPython itself.
7174

7275
This proposal brings us a bit closer to reserving underscores
73-
only for truly private, unstable, hands-off API.
76+
only for truly internal, private, hands-off API.
7477

7578

7679
Warning about API that is changed often
7780
---------------------------------------
7881

7982
The ``PyCode_New()`` family is an example of functions that are
80-
documented as unstable, and also often change in practice.
83+
documented as unstable (“Calling [it] directly can bind you to a precise
84+
Python version”), and also often change in practice.
8185

82-
Moving it to the semi-stable tier will make its status obvious even
86+
Moving it to the unstable tier will make its status obvious even
8387
to people who don't read the docs carefully enough, and will make it
8488
hard to use accidentally.
8589

@@ -90,16 +94,16 @@ Changes during the Beta period
9094
Since the API itself can change continuously up until Beta 1 (feature freeze)
9195
of a minor version, major users of this API are unlikely to test
9296
Alpha releases and provide feedback.
93-
It is very difficult to determine what needs to be exposed as semi-stable.
97+
It is very difficult to determine what needs to be exposed as unstable.
9498

95-
Additions to the semi-stable tier will count as *stabilization*,
99+
Additions to the unstable tier will count as *stabilization*,
96100
and will be allowed up to Release Candidate 1.
97101

98102

99103
Specification
100104
=============
101105

102-
Several functions and types (“APIs”) will be moved to a new *semi-stable* tier.
106+
Several functions and types (“APIs”) will be moved to a new *unstable* tier.
103107

104108
They will be expected to stay stable across patch releases,
105109
but may change or be removed without warning in minor releases (3.x.0),
@@ -109,20 +113,20 @@ When they change significantly, code that uses them should no longer compile
109113
(e.g. arguments should be added/removed, or a function should be renamed,
110114
but the semantic meaning of an argument should not change).
111115

112-
Their definitions will be moved to a new directory, ``Include/semistable/``,
116+
Their definitions will be moved to a new directory, ``Include/unstable/``,
113117
and will be included from ``Python.h``.
114118

115119
From Python 3.12 on, these APIs will only be usable when the
116-
``Py_USING_SEMI_STABLE_API`` macro is defined.
120+
``Py_USING_UNSTABLE_API`` macro is defined.
117121
CPython will only define the macro for building CPython itself
118122
(``Py_BUILD_CORE``).
119123

120-
To make transition to semi-stable API easier,
121-
in Python 3.11 the APIs will be available without ``Py_USING_SEMI_STABLE_API``
124+
To make transition to unstable API easier,
125+
in Python 3.11 the APIs will be available without ``Py_USING_UNSTABLE_API``
122126
defined. In this case, using them will generate a deprecation warning on
123127
compilers that support ``Py_DEPRECATED``.
124128

125-
A similar deprecation period will be used when making more APIs semi-stable
129+
A similar deprecation period will be used when making more APIs unstable
126130
in the future:
127131

128132
- When moving from public API, the deprecation period should follow Python's
@@ -137,25 +141,25 @@ Leading underscores will be removed from the names of the moved APIs.
137141
The old underscored name of a renamed API will be available (as an alias
138142
using ``#define``) at least until that API changes.
139143

140-
The semi-stable C-API tier and ``Py_USING_SEMI_STABLE_API`` will be documented,
141-
and documentation of each semi-stable API will be updated.
144+
The unstable C-API tier and ``Py_USING_UNSTABLE_API`` will be documented,
145+
and documentation of each unstable API will be updated.
142146

143147

144148
Adjustments during Beta periods
145149
-------------------------------
146150

147-
New APIs can be added to the semi-stable tier, and private APIs can be moved
151+
New APIs can be added to the unstable tier, and private APIs can be moved
148152
to it, up to the first release candidate of a new minor version.
149153
Consensus on the ``capi-sig`` or ``python-dev`` is needed in the Beta period.
150154

151155
In the Beta period, no API may be moved to more private tier, e.g.
152156
what is public in Beta 1 must stay public until the final release.
153157

154158

155-
Initial semi-stable API
156-
-----------------------
159+
Initial unstable API
160+
--------------------
157161

158-
The following API will initially be semi-stable.
162+
The following API will initially be unstable.
159163
The set may be adjusted for 3.11.
160164

161165
Code object constructors:
@@ -211,9 +215,7 @@ This is outside the scope of the PEP.
211215
Open Issues
212216
===========
213217

214-
- “Semi-stable” is not a perfect name.
215-
216-
- The exact set of exposed API may change.
218+
The exact set of exposed API may change.
217219

218220

219221
Copyright

0 commit comments

Comments
 (0)