8000 Add deprecation notice for ~ on bool to Doc/whatsnew/3.12.rst · python/cpython@bf02fd4 · GitHub
[go: up one dir, main page]

Skip to content

Commit bf02fd4

Browse files
committed
Add deprecation notice for ~ on bool to Doc/whatsnew/3.12.rst
1 parent e177cac commit bf02fd4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Doc/whatsnew/3.12.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,11 @@ Deprecated
692692
Python 3.14, when ``'data'`` filter will become the default.
693693
See :ref:`tarfile-extraction-filter` for details.
694694

695+
* The bitwise inversion operator (~) on bool is deprecated. It will throw an
696+
error in Python 3.14. Use ``not`` for logical negation of bools instead.
697+
In the rare case that you really need the bitwise inversion of the underlying
698+
``int``, convert to int explicitly ``~int(x)``. (Contributed by Tim Hoffmann
699+
in :gh:`103487`.)
695700

696701
Pending Removal in Python 3.13
697702
------------------------------

0 commit comments

Comments
 (0)
0