[Python-checkins] [3.10] bpo-46732: fix __bool__ docstring (GH-31301) (GH-31473)

miss-islington webhook-mailer at python.org
Mon Feb 21 12:18:57 EST 2022


https://github.com/python/cpython/commit/c596ecbf821843de0e044f0d4da34c6b49a06907
commit: c596ecbf821843de0e044f0d4da34c6b49a06907
branch: 3.10
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: miss-islington <31488909+miss-islington at users.noreply.github.com>
date: 2022-02-21T09:18:48-08:00
summary:

[3.10] bpo-46732: fix __bool__ docstring (GH-31301) (GH-31473)



(cherry picked from commit 0a222db2bca63070f429c0e613707da1bdfaf0e0)


Co-authored-by: Jelle Zijlstra <jelle.zijlstra at gmail.com>

files:
A Misc/NEWS.d/next/Core and Builtins/2022-02-12-11-16-40.bpo-46732.3Z_qxd.rst
M Objects/typeobject.c

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 0000000000000..9937116bb2e7b
--- /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 deffeb2ccc25d..b3ba1208eb253 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -7996,7 +7996,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, "<<"),



More information about the Python-checkins mailing list