changeset: 95754:03330e5edb37 parent: 95751:03b2259c6cd3 parent: 95753:a480f470c469 user: Serhiy Storchaka date: Tue Apr 21 21:11:13 2015 +0300 files: Lib/pydoc.py Lib/test/test_pydoc.py Misc/NEWS description: Issue #23008: Fixed resolving attributes with boolean value is False in pydoc. diff -r 03b2259c6cd3 -r 03330e5edb37 Lib/pydoc.py --- a/Lib/pydoc.py Tue Apr 21 12:07:06 2015 -0400 +++ b/Lib/pydoc.py Tue Apr 21 21:11:13 2015 +0300 @@ -1588,7 +1588,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. Use help() to get the interactive help utility. diff -r 03b2259c6cd3 -r 03330e5edb37 Lib/test/test_pydoc.py --- a/Lib/test/test_pydoc.py Tue Apr 21 12:07:06 2015 -0400 +++ b/Lib/test/test_pydoc.py Tue Apr 21 21:11:13 2015 +0300 @@ -1006,6 +1006,14 @@ 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 -r 03b2259c6cd3 -r 03330e5edb37 Misc/NEWS --- a/Misc/NEWS Tue Apr 21 12:07:06 2015 -0400 +++ b/Misc/NEWS Tue Apr 21 21:11:13 2015 +0300 @@ -15,6 +15,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 when JoinableQueue was merged with Queue).