Skip to content

Commit 9d64094

Browse files
authored
PEP 387: Backwards Compatibility Policy updates/clarifications (#2931)
Approved in: https://discuss.python.org/t/22042/9
1 parent cd981f1 commit 9d64094

File tree

1 file changed

+22
-7
lines changed

1 file changed

+22
-7
lines changed

pep-0387.txt

+22-7
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ be removed at any time in any way. These include:
6767
types that are prefixed by "_" (except special names).
6868

6969
- Anything documented publicly as being private.
70+
Note that if something is not documented at all, it is *not*
71+
automatically considered private.
7072

7173
- Imported modules (unless explicitly documented as part of the public
7274
API; e.g. importing the ``bacon`` module in the ``spam`` does not
@@ -123,22 +125,35 @@ several releases:
123125
appropriate SIG. A PEP or similar document may be written.
124126
Hopefully users of the affected API will pipe up to comment.
125127

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
127130
function or method to perform the new behavior; old usage should
128131
raise the warning. If an API is being removed, simply warn
129132
whenever it is entered. ``DeprecationWarning`` is the usual
130133
warning category to use, but ``PendingDeprecationWarning`` may be
131134
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.
136141

137142
3. Wait for the warning to appear in at least two minor Python
138143
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
140145
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.
142157

143158
4. See if there's any feedback. Users not involved in the original
144159
discussions may comment now after seeing the warning. Perhaps

0 commit comments

Comments
 (0)