summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2015-04-21 18:11:13 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2015-04-21 18:11:13 (GMT)
commitf5e8540e1bda85f041fc7ce592e3079c16f18a1b (patch)
tree9130a4249b59971b0e0210d2e8f326b3792a8646
parent273a720f876e754013e17fab0ab9b599284239f7 (diff)
parentb6076fb13c6bf97f4fae76da478a26e0f4f24879 (diff)
downloadcpython-f5e8540e1bda85f041fc7ce592e3079c16f18a1b.zip
cpython-f5e8540e1bda85f041fc7ce592e3079c16f18a1b.tar.gz
cpython-f5e8540e1bda85f041fc7ce592e3079c16f18a1b.tar.bz2
Issue #23008: Fixed resolving attributes with boolean value is False in pydoc.
-rwxr-xr-xLib/pydoc.py2
-rw-r--r--Lib/test/test_pydoc.py8
-rw-r--r--Misc/NEWS2
3 files changed, 11 insertions, 1 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 264e407..306dcaf 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -1588,7 +1588,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.
Use help() to get the interactive help utility.
diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index 50ed4d5..6a967c3 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -1006,6 +1006,14 @@ class PydocWithMetaClasses(unittest.TestCase):
result = output.getvalue().strip()
self.assertEqual(expected_text, result)
+ 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
index 515a6ef..0c38481 100644
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -15,6 +15,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 when
JoinableQueue was merged with Queue).