Commit c1a9e68a authored by Serhiy Storchaka's avatar Serhiy Storchaka

Issue #23008: Fixed resolving attributes with boolean value is False in pydoc.

parent 762d7cac
...@@ -1590,7 +1590,7 @@ def resolve(thing, forceload=0): ...@@ -1590,7 +1590,7 @@ def resolve(thing, forceload=0):
"""Given an object or a path to an object, get the object and its name.""" """Given an object or a path to an object, get the object and its name."""
if isinstance(thing, str): if isinstance(thing, str):
object = locate(thing, forceload) object = locate(thing, forceload)
if not object: if object is None:
raise ImportError('no Python documentation found for %r' % thing) raise ImportError('no Python documentation found for %r' % thing)
return object, thing return object, thing
else: else:
......
...@@ -1029,6 +1029,14 @@ class PydocWithMetaClasses(unittest.TestCase): ...@@ -1029,6 +1029,14 @@ class PydocWithMetaClasses(unittest.TestCase):
print_diffs(expected_text, result) print_diffs(expected_text, result)
self.fail("outputs are not equal, see diff above") 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 @reap_threads
def test_main(): def test_main():
......
...@@ -31,6 +31,8 @@ Core and Builtins ...@@ -31,6 +31,8 @@ Core and Builtins
Library Library
------- -------
- Issue #23008: Fixed resolving attributes with boolean value is False in pydoc.
- Fix asyncio issue 235: LifoQueue and PriorityQueue's put didn't - Fix asyncio issue 235: LifoQueue and PriorityQueue's put didn't
increment unfinished tasks (this bug was introduced in 3.4.3 when increment unfinished tasks (this bug was introduced in 3.4.3 when
JoinableQueue was merged with Queue). JoinableQueue was merged with Queue).
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment