@@ -67,6 +67,8 @@ be removed at any time in any way. These include:
67
67
types that are prefixed by "_" (except special names).
68
68
69
69
- Anything documented publicly as being private.
70
+ Note that if something is not documented at all, it is *not*
71
+ automatically considered private.
70
72
71
73
- Imported modules (unless explicitly documented as part of the public
72
74
API; e.g. importing the ``bacon`` module in the ``spam`` does not
@@ -123,22 +125,35 @@ several releases:
123
125
appropriate SIG. A PEP or similar document may be written.
124
126
Hopefully users of the affected API will pipe up to comment.
125
127
126
- 2. Add a warning. If behavior is changing, the API may gain a new
128
+ 2. Add a warning to the current ``main`` branch.
129
+ If behavior is changing, the API may gain a new
127
130
function or method to perform the new behavior; old usage should
128
131
raise the warning. If an API is being removed, simply warn
129
132
whenever it is entered. ``DeprecationWarning`` is the usual
130
133
warning category to use, but ``PendingDeprecationWarning`` may be
131
134
used in special cases where the old and new versions of the API will
132
- coexist for many releases [#warnings]_. Compiler warnings are also
133
- acceptable. The warning message should include the release the
134
- incompatibility is expected to become the default and a link to an
135
- issue that users can post feedback to.
135
+ coexist for many releases [#warnings]_. The warning message should
136
+ include the release the incompatibility is expected to become the
137
+ default and a link to an issue that users can post feedback to.
138
+
139
+ For C API, a compiler warning generated by the ``Py_DEPRECATED`` macro
140
+ is also acceptable.
136
141
137
142
3. Wait for the warning to appear in at least two minor Python
138
143
versions of the same major version, or one minor version in an older
139
- major version (e.g. for a warning in Python 3.10, you either wait
144
+ major version (e.g. for a warning in Python 3.10.0 , you either wait
140
145
until at least Python 3.12 or Python 4.0 to make the change).
141
- It's fine to wait more than two releases.
146
+
147
+ It's fine to wait more than two releases, for example:
148
+
149
+ - If the expected maintenance overhead and security risk of the
150
+ deprecated behavior is small (e.g. an old function is reimplemented
151
+ in terms of a new, more general one), it can stay indefinitely
152
+ (or until the situation changes).
153
+
154
+ - If the deprecated feature is replaced by a new one, it should
155
+ generally be removed only after the last Python version
156
+ *without* the new feature reaches end of support.
142
157
143
158
4. See if there's any feedback. Users not involved in the original
144
159
discussions may comment now after seeing the warning. Perhaps
0 commit comments