]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
fix __bool__ docstring (GH-31301)
authorJelle Zijlstra <jelle.zijlstra@gmail.com>
Mon, 21 Feb 2022 15:42:27 +0000 (07:42 -0800)
committerGitHub <noreply@github.com>
Mon, 21 Feb 2022 15:42:27 +0000 (07:42 -0800)
Misc/NEWS.d/next/Core and Builtins/2022-02-12-11-16-40.bpo-46732.3Z_qxd.rst [new file with mode: 0644]
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 (file)
index 0000000..9937116
--- /dev/null
@@ -0,0 +1,2 @@
+Correct the docstring for the :meth:`__bool__` method. Patch by Jelle
+Zijlstra.
index 8c4901119de7df87512b6c45369fddba676abcc0..4b7035c81e533d694276642235c9ca7ebb29a275 100644 (file)
@@ -8065,7 +8065,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, "<<"),