Feature or enhancement
It is scheduled for removal in 3.16:
|
static PyObject * |
|
bool_invert(PyObject *v) |
|
{ |
|
if (PyErr_WarnEx(PyExc_DeprecationWarning, |
|
"Bitwise inversion '~' on bool is deprecated and will be removed in " |
|
"Python 3.16. This returns the bitwise inversion of the underlying int " |
|
"object and is usually not what you expect from negating " |
|
"a bool. Use the 'not' operator for boolean negation or " |
|
"~int(x) if you really want the bitwise inversion of the " |
|
"underlying int.", |
|
1) < 0) { |
|
return NULL; |
|
} |
|
return PyLong_Type.tp_as_number->nb_invert(v); |
|
} |
Refs #103487
Refs #82012
Linked PRs
Feature or enhancement
It is scheduled for removal in 3.16:
cpython/Objects/boolobject.c
Lines 70 to 84 in 49918f5
Refs #103487
Refs #82012
Linked PRs
bool.__invert__magic method #149533