Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 1ce0073

Browse files
author
Skip Montanaro
committed
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
1 parent ccbb0ed commit 1ce0073

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

Lib/cmd.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -214,13 +214,13 @@ def do_help(self, arg):
214214
# XXX check arg syntax
215215
try:
216216
func = getattr(self, 'help_' + arg)
217-
except:
217+
except AttributeError:
218218
try:
219219
doc=getattr(self, 'do_' + arg).__doc__
220220
if doc:
221221
print doc
222222
return
223-
except:
223+
except AttributeError:
224224
pass
225225
print self.nohelp % (arg,)
226226
return

0 commit comments

Comments
 (0)