summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>2022-02-21 17:18:55 (GMT)
committerGitHub <noreply@github.com>2022-02-21 17:18:55 (GMT)
commit8eb18d842c37c37c1f9316c7e171aad36e875b9a (patch)
tree5e886b44f0a61b5de60ed1244eeea4a210b62255
parent336a916f75642dfe2d87e237981686051d5d51f8 (diff)
downloadcpython-8eb18d842c37c37c1f9316c7e171aad36e875b9a.zip
cpython-8eb18d842c37c37c1f9316c7e171aad36e875b9a.tar.gz
cpython-8eb18d842c37c37c1f9316c7e171aad36e875b9a.tar.bz2
[3.9] bpo-46732: fix __bool__ docstring (GH-31301) (GH-31474)
(cherry picked from commit 0a222db2bca63070f429c0e613707da1bdfaf0e0) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
-rw-r--r--Misc/NEWS.d/next/Core and Builtins/2022-02-12-11-16-40.bpo-46732.3Z_qxd.rst2
-rw-r--r--Objects/typeobject.c2
2 files changed, 3 insertions, 1 deletions
diff --git a/Misc/NEWS.d/next/Core and Builtins/2022-02-12-11-16-40.bpo-46732.3Z_qxd.rst b/Misc/NEWS.d/next/Core and Builtins/2022-02-12-11-16-40.bpo-46732.3Z_qxd.rst
new file mode 100644
index 0000000..9937116
--- /dev/null
+++ b/Misc/NEWS.d/next/Core and Builtins/2022-02-12-11-16-40.bpo-46732.3Z_qxd.rst
@@ -0,0 +1,2 @@
+Correct the docstring for the :meth:`__bool__` method. Patch by Jelle
+Zijlstra.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index d9ea9e8..cb0bb46 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -7236,7 +7236,7 @@ static slotdef slotdefs[] = {
UNSLOT("__abs__", nb_absolute, slot_nb_absolute, wrap_unaryfunc,
"abs(self)"),
UNSLOT("__bool__", nb_bool, slot_nb_bool, wrap_inquirypred,
- "self != 0"),
+ "True if self else False"),
UNSLOT("__invert__", nb_invert, slot_nb_invert, wrap_unaryfunc, "~self"),
BINSLOT("__lshift__", nb_lshift, slot_nb_lshift, "<<"),
RBINSLOT("__rlshift__", nb_lshift, slot_nb_lshift, "<<"),