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

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


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

Modified Files:
      Tag: release22-maint
	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.26.10.1
retrieving revision 1.26.10.2
diff -C2 -d -r1.26.10.1 -r1.26.10.2
*** inspect.py	13 Mar 2002 03:19:18 -0000	1.26.10.1
--- inspect.py	17 Mar 2002 18:57:07 -0000	1.26.10.2
***************
*** 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:]: