tighten up except - in this context, AttributeError is the only exception
authorSkip Montanaro <skip@pobox.com>
Sun, 24 Mar 2002 16:34:21 +0000 (16:34 +0000)
committerSkip Montanaro <skip@pobox.com>
Sun, 24 Mar 2002 16:34:21 +0000 (16:34 +0000)
that can be raised - do_help won't be called if arg is not a string

Lib/cmd.py

index 5f955a7c10b1c5e5664e7145d8b002d90ee0d681..5bbf4bcc7c8e4e9b833b246771f83fc1b9c1695c 100644 (file)
@@ -214,13 +214,13 @@ class Cmd:
             # XXX check arg syntax
             try:
                 func = getattr(self, 'help_' + arg)
-            except:
+            except AttributeError:
                 try:
                     doc=getattr(self, 'do_' + arg).__doc__
                     if doc:
                         print doc
                         return
-                except:
+                except AttributeError:
                     pass
                 print self.nohelp % (arg,)
                 return