From: Skip Montanaro Date: Sun, 24 Mar 2002 16:34:21 +0000 (+0000) Subject: tighten up except - in this context, AttributeError is the only exception X-Git-Tag: v2.3c1~6364 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1ce0073a4e1e5bbc3d710a6c4f1700db6b29827c;p=python 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 --- diff --git a/Lib/cmd.py b/Lib/cmd.py index 5f955a7c10..5bbf4bcc7c 100644 --- a/Lib/cmd.py +++ b/Lib/cmd.py @@ -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