From: Serhiy Storchaka Date: Tue, 21 Apr 2015 18:11:13 +0000 (+0300) Subject: Issue #23008: Fixed resolving attributes with boolean value is False in pydoc. X-Git-Tag: v3.5.0b1~312 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f5e8540e1bda85f041fc7ce592e3079c16f18a1b;p=python Issue #23008: Fixed resolving attributes with boolean value is False in pydoc. --- f5e8540e1bda85f041fc7ce592e3079c16f18a1b diff --cc Lib/pydoc.py index 264e407e47,0c7b60d98d..306dcafae0 --- a/Lib/pydoc.py +++ b/Lib/pydoc.py @@@ -1588,11 -1590,8 +1588,11 @@@ 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) + raise ImportError('''\ +No Python documentation found for %r. +Use help() to get the interactive help utility. +Use help(str) for help on the str class.''' % thing) return object, thing else: name = getattr(thing, '__name__', None) diff --cc Lib/test/test_pydoc.py index 50ed4d51ec,0e990b62be..6a967c30ab --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@@ -1004,8 -1025,18 +1004,16 @@@ class PydocWithMetaClasses(unittest.Tes helper(C) expected_text = expected_missingattribute_pattern % __name__ result = output.getvalue().strip() - if result != expected_text: - print_diffs(expected_text, result) - self.fail("outputs are not equal, see diff above") + 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 --cc Misc/NEWS index 515a6ef0ad,fb2ced1c57..0c38481351 --- a/Misc/NEWS +++ b/Misc/NEWS @@@ -12,41 -12,6 +12,43 @@@ Core and Builtin - Issue #24022: Fix tokenizer crash when processing undecodable source code. +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). + +- Issue #23908: os functions now reject paths with embedded null character + on Windows instead of silently truncate them. + +- Issue #23728: binascii.crc_hqx() could return an integer outside of the range + 0-0xffff for empty data. + + +What's New in Python 3.5.0 alpha 4? +=================================== + +Release date: 2015-04-19 + +Core and Builtins +----------------- + +- Issue #22980: Under Linux, GNU/KFreeBSD and the Hurd, C extensions now include + the architecture triplet in the extension name, to make it easy to test builds + for different ABIs in the same working tree. Under OS X, the extension name + now includes PEP 3149-style information. + +- Issue #22631: Added Linux-specific socket constant CAN_RAW_FD_FRAMES. + Patch courtesy of Joe Jevnik. + +- Issue #23731: Implement PEP 488: removal of .pyo files. + +- Issue #23726: Don't enable GC for user subclasses of non-GC types that + don't add any new fields. Patch by Eugene Toder. + - Issue #23309: Avoid a deadlock at shutdown if a daemon thread is aborted while it is holding a lock to a buffered I/O object, and the main thread tries to use the same I/O object (typically stdout or stderr). A fatal