1
1
PEP: 689
2
- Title: Semi-stable C API tier
2
+ Title: Unstable C API tier
3
3
Author: Petr Viktorin <
[email protected] >
4
4
Status: Draft
5
5
Type: Standards Track
@@ -13,7 +13,7 @@ Post-History: `27-Apr-2022 <https://mail.python.org/archives/list/python-dev@pyt
13
13
Abstract
14
14
========
15
15
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 *,
17
17
meaning that they will not change in patch (bugfix/security) releases,
18
18
but may change between minor releases (e.g. between 3.11 and 3.12) without
19
19
deprecation warnings.
@@ -29,9 +29,12 @@ The Python C-API is currently divided into `three tiers <https://devguide.python
29
29
<387 >`, and requires deprecation warnings before changes
30
30
- Private (internal) API, which can change at any time.
31
31
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.
35
38
36
39
37
40
Setting Stability Expectations
@@ -49,7 +52,7 @@ in patch releases:
49
52
- Patch releases only contain bugfixes, which are unlikely to
50
53
change the API.
51
54
52
- Semi-stable API will make the stability expectations more explicit.
55
+ Unstable API will make the stability expectations more explicit.
53
56
54
57
It will also hopefully encourage existing users of the private API to
55
58
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
70
73
changing are documented and used outside CPython itself.
71
74
72
75
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.
74
77
75
78
76
79
Warning about API that is changed often
77
80
---------------------------------------
78
81
79
82
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.
81
85
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
83
87
to people who don't read the docs carefully enough, and will make it
84
88
hard to use accidentally.
85
89
@@ -90,16 +94,16 @@ Changes during the Beta period
90
94
Since the API itself can change continuously up until Beta 1 (feature freeze)
91
95
of a minor version, major users of this API are unlikely to test
92
96
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 .
94
98
95
- Additions to the semi-stable tier will count as *stabilization *,
99
+ Additions to the unstable tier will count as *stabilization *,
96
100
and will be allowed up to Release Candidate 1.
97
101
98
102
99
103
Specification
100
104
=============
101
105
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.
103
107
104
108
They will be expected to stay stable across patch releases,
105
109
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
109
113
(e.g. arguments should be added/removed, or a function should be renamed,
110
114
but the semantic meaning of an argument should not change).
111
115
112
- Their definitions will be moved to a new directory, ``Include/semistable / ``,
116
+ Their definitions will be moved to a new directory, ``Include/unstable / ``,
113
117
and will be included from ``Python.h ``.
114
118
115
119
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.
117
121
CPython will only define the macro for building CPython itself
118
122
(``Py_BUILD_CORE ``).
119
123
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 ``
122
126
defined. In this case, using them will generate a deprecation warning on
123
127
compilers that support ``Py_DEPRECATED ``.
124
128
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
126
130
in the future:
127
131
128
132
- 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.
137
141
The old underscored name of a renamed API will be available (as an alias
138
142
using ``#define ``) at least until that API changes.
139
143
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.
142
146
143
147
144
148
Adjustments during Beta periods
145
149
-------------------------------
146
150
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
148
152
to it, up to the first release candidate of a new minor version.
149
153
Consensus on the ``capi-sig `` or ``python-dev `` is needed in the Beta period.
150
154
151
155
In the Beta period, no API may be moved to more private tier, e.g.
152
156
what is public in Beta 1 must stay public until the final release.
153
157
154
158
155
- Initial semi-stable API
156
- -----------------------
159
+ Initial unstable API
160
+ --------------------
157
161
158
- The following API will initially be semi-stable .
162
+ The following API will initially be unstable .
159
163
The set may be adjusted for 3.11.
160
164
161
165
Code object constructors:
@@ -211,9 +215,7 @@ This is outside the scope of the PEP.
211
215
Open Issues
212
216
===========
213
217
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.
217
219
218
220
219
221
Copyright
0 commit comments