[Python-checkins] CVS: python/dist/src/Lib pydoc.py,1.42,1.43

Tim Peters tim_one@users.sourceforge.net
Wed, 19 Sep 2001 23:08:26 -0700


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

Modified Files:
	pydoc.py 
Log Message:
Since inspect.isfunction(obj) is a precondition for calling
inspect.getargspec(obj), test isfunction() directly in pydoc.py instead
of trying to indirectly deduce isfunction() in pydoc by virtue of
failing a combination of other tests.  This shouldn't have any visible
effect, except perhaps to squash a TypeError death if there was some path
thru this code that was inferring isfunction() by mistake.


Index: pydoc.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/pydoc.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** pydoc.py	2001/09/20 05:13:38	1.42
--- pydoc.py	2001/09/20 06:08:24	1.43
***************
*** 660,666 ****
              title = '<a name="%s"><strong>%s</strong></a> = %s' % (
                  anchor, name, reallink)
!         if inspect.isbuiltin(object) or inspect.ismethoddescriptor(object):
!             argspec = '(...)'
!         else:
              args, varargs, varkw, defaults = inspect.getargspec(object)
              argspec = inspect.formatargspec(
--- 660,664 ----
              title = '<a name="%s"><strong>%s</strong></a> = %s' % (
                  anchor, name, reallink)
!         if inspect.isfunction(object):
              args, varargs, varkw, defaults = inspect.getargspec(object)
              argspec = inspect.formatargspec(
***************
*** 669,672 ****
--- 667,672 ----
                  decl = '<em>lambda</em>'
                  argspec = argspec[1:-1] # remove parentheses
+         else:
+             argspec = '(...)'
  
          decl = title + argspec + (note and self.small(self.grey(
***************
*** 917,923 ****
                  skipdocs = 1
              title = self.bold(name) + ' = ' + realname
!         if inspect.isbuiltin(object) or inspect.ismethoddescriptor(object):
!             argspec = '(...)'
!         else:
              args, varargs, varkw, defaults = inspect.getargspec(object)
              argspec = inspect.formatargspec(
--- 917,921 ----
                  skipdocs = 1
              title = self.bold(name) + ' = ' + realname
!         if inspect.isfunction(object):
              args, varargs, varkw, defaults = inspect.getargspec(object)
              argspec = inspect.formatargspec(
***************
*** 926,929 ****
--- 924,929 ----
                  title = 'lambda'
                  argspec = argspec[1:-1] # remove parentheses
+         else:
+             argspec = '(...)'
          decl = title + argspec + note