[Python-checkins] python/dist/src/Lib pydoc.py,1.83,1.84

bcannon@users.sourceforge.net bcannon@users.sourceforge.net
Wed, 11 Jun 2003 16:38:58 -0700


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

Modified Files:
	pydoc.py 
Log Message:
Have pydoc try handling an object as "other" if the object does not act the way
it expects based on what inspect classifies it as.

Closes bug #729103 .


Index: pydoc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v
retrieving revision 1.83
retrieving revision 1.84
diff -C2 -d -r1.83 -r1.84
*** pydoc.py	26 May 2003 13:49:54 -0000	1.83
--- pydoc.py	11 Jun 2003 23:38:55 -0000	1.84
***************
*** 276,282 ****
          """Generate documentation for an object."""
          args = (object, name) + args
!         if inspect.ismodule(object): return self.docmodule(*args)
!         if inspect.isclass(object): return self.docclass(*args)
!         if inspect.isroutine(object): return self.docroutine(*args)
          return self.docother(*args)
  
--- 276,289 ----
          """Generate documentation for an object."""
          args = (object, name) + args
!         # 'try' clause is to attempt to handle the possibility that inspect
!         # identifies something in a way that pydoc itself has issues handling;
!         # think 'super' and how it is a descriptor (which raises the exception
!         # by lacking a __name__ attribute) and an instance.
!         try:
!             if inspect.ismodule(object): return self.docmodule(*args)
!             if inspect.isclass(object): return self.docclass(*args)
!             if inspect.isroutine(object): return self.docroutine(*args)
!         except AttributeError:
!             pass
          return self.docother(*args)