mirror of
https://github.com/python/cpython.git
synced 2025-11-08 17:41:42 +00:00
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
This commit is contained in:
parent
ccbb0edf0e
commit
1ce0073a4e
1 changed files with 2 additions and 2 deletions
|
|
@ -214,13 +214,13 @@ def do_help(self, arg):
|
||||||
# XXX check arg syntax
|
# XXX check arg syntax
|
||||||
try:
|
try:
|
||||||
func = getattr(self, 'help_' + arg)
|
func = getattr(self, 'help_' + arg)
|
||||||
except:
|
except AttributeError:
|
||||||
try:
|
try:
|
||||||
doc=getattr(self, 'do_' + arg).__doc__
|
doc=getattr(self, 'do_' + arg).__doc__
|
||||||
if doc:
|
if doc:
|
||||||
print doc
|
print doc
|
||||||
return
|
return
|
||||||
except:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
print self.nohelp % (arg,)
|
print self.nohelp % (arg,)
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue