]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Issue #23008: Fixed resolving attributes with boolean value is False in pydoc.
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 21 Apr 2015 18:09:48 +0000 (21:09 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 21 Apr 2015 18:09:48 +0000 (21:09 +0300)
Lib/pydoc.py
Lib/test/test_pydoc.py
Misc/NEWS

index faaa85953566b9cdb013773d2127cacb475e42ee..0c7b60d98dd22582fd62308fa22ab0b7ddb646e0 100755 (executable)
@@ -1590,7 +1590,7 @@ def resolve(thing, forceload=0):
     """Given an object or a path to an object, get the object and its name."""
     if isinstance(thing, str):
         object = locate(thing, forceload)
-        if not object:
+        if object is None:
             raise ImportError('no Python documentation found for %r' % thing)
         return object, thing
     else:
index 83f2ec94881b8e741f361848181d9fa2f42a243d..0e990b62bebb3ea6ae0ddd9ed8b2d364633327cd 100644 (file)
@@ -1029,6 +1029,14 @@ class PydocWithMetaClasses(unittest.TestCase):
             print_diffs(expected_text, result)
             self.fail("outputs are not equal, see diff above")
 
+    def test_resolve_false(self):
+        # Issue #23008: pydoc enum.{,Int}Enum failed
+        # because bool(enum.Enum) is False.
+        with captured_stdout() as help_io:
+            pydoc.help('enum.Enum')
+        helptext = help_io.getvalue()
+        self.assertIn('class Enum', helptext)
+
 
 @reap_threads
 def test_main():
index 183f7d19ca69ccd2695a5c914b72c88c12fbe1d7..fb2ced1c57a1d8b36a518150681a0532d7fde58e 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -31,6 +31,8 @@ Core and Builtins
 Library
 -------
 
+- Issue #23008: Fixed resolving attributes with boolean value is False in pydoc.
+
 - Fix asyncio issue 235: LifoQueue and PriorityQueue's put didn't
   increment unfinished tasks (this bug was introduced in 3.4.3 when
   JoinableQueue was merged with Queue).