Change callability check
TypeErrors are thrown in a wide variety of situations, most of which have nothing to do with calling an uncallable object. The appropriate test is to use the built-in callable() function, which actually tests if the object is callable.
This commit is contained in:
parent
27875ba04d
commit
1feceea4e8
1 changed files with 2 additions and 2 deletions
|
|
@ -296,9 +296,9 @@ class CmdSet(with_metaclass(_CmdSetMeta, object)):
|
||||||
result (any): An instantiated Command or the input unmodified.
|
result (any): An instantiated Command or the input unmodified.
|
||||||
|
|
||||||
"""
|
"""
|
||||||
try:
|
if callable(cmd):
|
||||||
return cmd()
|
return cmd()
|
||||||
except TypeError:
|
else:
|
||||||
return cmd
|
return cmd
|
||||||
|
|
||||||
def _duplicate(self):
|
def _duplicate(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue