[Python-checkins] CVS: python/dist/src/Lib inspect.py,1.27,1.28

Tim Peters tim_one@users.sourceforge.net
Sun, 17 Mar 2002 10:56:22 -0800


Update of /cvsroot/python/python/dist/src/Lib
In directory usw-pr-cvs1:/tmp/cvs-serv28202/python/Lib

Modified Files:
	inspect.py 
Log Message:
SF patch 530070: pydoc regression, from Martin and Guido.
Change the way __doc__ is handled, to avoid blowing up on non-string
__doc__ values.


Index: inspect.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/inspect.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** inspect.py	13 Mar 2002 03:14:26 -0000	1.27
--- inspect.py	17 Mar 2002 18:56:20 -0000	1.28
***************
*** 264,269 ****
      indented to line up with blocks of code, any whitespace than can be
      uniformly removed from the second line onwards is removed."""
!     if hasattr(object, '__doc__') and object.__doc__:
!         lines = string.split(string.expandtabs(object.__doc__), '\n')
          margin = None
          for line in lines[1:]:
--- 264,278 ----
      indented to line up with blocks of code, any whitespace than can be
      uniformly removed from the second line onwards is removed."""
!     try:
!         doc = object.__doc__
!     except AttributeError:
!         return None
!     if not isinstance(doc, (str, unicode)):
!         return None
!     try:
!         lines = string.split(string.expandtabs(doc), '\n')
!     except UnicodeError:
!         return None
!     else:
          margin = None
          for line in lines[1:]: