summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-21 18:09:48 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-21 18:09:48 (GMT)
commitb6076fb13c6bf97f4fae76da478a26e0f4f24879 (patch)
tree3dfc0c5ce941dc2650c86df3f2a7fc7844f2e1d9 /Lib
parentd73aca769f1f6eebb46faa9161cbebe806db3659 (diff)
downloadcpython-b6076fb13c6bf97f4fae76da478a26e0f4f24879.zip
cpython-b6076fb13c6bf97f4fae76da478a26e0f4f24879.tar.gz
cpython-b6076fb13c6bf97f4fae76da478a26e0f4f24879.tar.bz2
Issue #23008: Fixed resolving attributes with boolean value is False in pydoc.
Diffstat (limited to 'Lib')
-rwxr-xr-xLib/pydoc.py2
-rw-r--r--Lib/test/test_pydoc.py8
2 files changed, 9 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index faaa859..0c7b60d 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -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:
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index 83f2ec9..0e990b6 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -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():