[Python-checkins] cpython (3.4): Issue #23008: Fixed resolving attributes with boolean value is False in pydoc.

serhiy.storchaka python-checkins at python.org
Tue Apr 21 20:11:47 CEST 2015


https://hg.python.org/cpython/rev/a480f470c469
changeset:   95753:a480f470c469
branch:      3.4
parent:      95750:414e08c478f4
user:        Serhiy Storchaka <storchaka at gmail.com>
date:        Tue Apr 21 21:09:48 2015 +0300
summary:
  Issue #23008: Fixed resolving attributes with boolean value is False in pydoc.

files:
  Lib/pydoc.py           |  2 +-
  Lib/test/test_pydoc.py |  8 ++++++++
  Misc/NEWS              |  2 ++
  3 files changed, 11 insertions(+), 1 deletions(-)


diff --git a/Lib/pydoc.py b/Lib/pydoc.py
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1590,7 +1590,7 @@
     """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:
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -1029,6 +1029,14 @@
             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():
diff --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -31,6 +31,8 @@
 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).

-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list