Skip to content

Commit 8290ea7

Browse files
committed
Add deprecation notice for ~ on bool to Doc/whatsnew/3.12.rst
1 parent 20dec73 commit 8290ea7

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

Doc/whatsnew/3.12.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,12 @@ Deprecated
608608
* The *onerror* argument of :func:`shutil.rmtree` is deprecated as will be removed
609609
in Python 3.14. Use *onexc* instead. (Contributed by Irit Katriel in :gh:`102828`.)
610610

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

612618
Pending Removal in Python 3.13
613619
------------------------------

0 commit comments

Comments
 (0)