]> granicus.if.org Git - python/commitdiff
Issue #23008: Fixed resolving attributes with boolean value is False in pydoc.
authorSerhiy Storchaka <storchaka@gmail.com>
Tue, 21 Apr 2015 18:11:13 +0000 (21:11 +0300)
committerSerhiy Storchaka <storchaka@gmail.com>
Tue, 21 Apr 2015 18:11:13 +0000 (21:11 +0300)
1  2 
Lib/pydoc.py
Lib/test/test_pydoc.py
Misc/NEWS

diff --cc Lib/pydoc.py
index 264e407e47c135ca090d7ad97992536ed4e723c4,0c7b60d98dd22582fd62308fa22ab0b7ddb646e0..306dcafae0640fc6968dc3313a1bce47d7e1651e
@@@ -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)
index 50ed4d51ec0e295c91097760e5dcae273b417301,0e990b62bebb3ea6ae0ddd9ed8b2d364633327cd..6a967c30ab0fc2609d3dd34f5f440a217e46e03a
@@@ -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 515a6ef0ad146bfba2540d654bb3c9a27d8ad0d2,fb2ced1c57a1d8b36a518150681a0532d7fde58e..0c38481351531717005a57740ba20a042f3adc5f
+++ 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