gh-122982: Extend the deprecation period for bool inversion by two ye… · python/cpython@249b083 · GitHub
Skip to content

Commit 249b083

Browse files
authored
gh-122982: Extend the deprecation period for bool inversion by two years (#123306)
1 parent 625d070 commit 249b083

6 files changed

Lines changed: 8 additions & 5 deletions

File tree

Doc/deprecations/pending-removal-in-3.16.rst

Lines changed: 3 additions & 0 deletions

Doc/deprecations/pending-removal-in-future.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ although there is currently no date scheduled for their removal.
1111

1212
* :mod:`builtins`:
1313

14-
* ``~bool``, bitwise inversion on bool.
1514
* ``bool(NotImplemented)``.
1615
* Generators: ``throw(type, exc, tb)`` and ``athrow(type, exc, tb)``
1716
signature is deprecated: use ``throw(exc)`` and ``athrow(exc)`` instead,

Doc/library/stdtypes.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,7 @@ over ``&``, ``|`` and ``^``.
868868
.. deprecated:: 3.12
869869

870870
The use of the bitwise inversion operator ``~`` is deprecated and will
871-
raise an error in Python 3.14.
871+
raise an error in Python 3.16.
872872

873873
:class:`bool` is a subclass of :class:`int` (see :ref:`typesnumeric`). In
874874
many numeric contexts, ``False`` and ``True`` behave like the integers 0 and 1, respectively.

Doc/whatsnew/3.12.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1319,7 +1319,7 @@ Deprecated
13191319
(Contributed by Brett Cannon in :gh:`65961`.)
13201320

13211321
* The bitwise inversion operator (``~``) on bool is deprecated. It will throw an
1322-
error in Python 3.14. Use ``not`` for logical negation of bools instead.
1322+
error in Python 3.16. Use ``not`` for logical negation of bools instead.
13231323
In the rare case that you really need the bitwise inversion of the underlying
13241324
``int``, convert to int explicitly: ``~int(x)``. (Contributed by Tim Hoffmann
13251325
in :gh:`103487`.)
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Extend the deprecation period for bool inversion (``~``) by two years.

Objects/boolobject.c

Lines changed: 2 additions & 2 deletions

0 commit comments

Comments
 (0)