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

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


https://hg.python.org/cpython/rev/03330e5edb37
changeset: 95754:03330e5edb37
parent: 95751:03b2259c6cd3
parent: 95753:a480f470c469
user: Serhiy Storchaka <storchaka at gmail.com>
date: Tue Apr 21 21:11:13 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
@@ -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 --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
@@ -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 --git a/Misc/NEWS b/Misc/NEWS
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -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).
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /