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

Skip Montanaro montanaro@users.sourceforge.net
Sun, 24 Mar 2002 08:34:24 -0800


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

Modified Files:
	cmd.py 
Log Message:
tighten up except - in this context, AttributeError is the only exception
that can be raised - do_help won't be called if arg is not a string


Index: cmd.py
===================================================================
RCS file: /cvsroot/python/python/dist/src/Lib/cmd.py,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** cmd.py	23 Mar 2002 20:43:59 -0000	1.27
--- cmd.py	24 Mar 2002 16:34:21 -0000	1.28
***************
*** 215,219 ****
              try:
                  func = getattr(self, 'help_' + arg)
!             except:
                  try:
                      doc=getattr(self, 'do_' + arg).__doc__
--- 215,219 ----
              try:
                  func = getattr(self, 'help_' + arg)
!             except AttributeError:
                  try:
                      doc=getattr(self, 'do_' + arg).__doc__
***************
*** 221,225 ****
                          print doc
                          return
!                 except:
                      pass
                  print self.nohelp % (arg,)
--- 221,225 ----
                          print doc
                          return
!                 except AttributeError:
                      pass
                  print self.nohelp % (arg,)