diff options
author | Eric Lin <anselor@gmail.com> | 2020-07-18 16:40:21 -0400 |
---|---|---|
committer | anselor <anselor@gmail.com> | 2020-08-04 13:38:08 -0400 |
commit | 2be779ccae8cbcf86ae9b36ae1003f70c23f05f9 (patch) | |
tree | 3306bae9bac4496696f425a05bec7720b381e639 /cmd2 | |
parent | 7b660a4e502140e6b6693e4a29f66f07dffb3378 (diff) | |
download | cmd2-git-2be779ccae8cbcf86ae9b36ae1003f70c23f05f9.tar.gz |
Added an additional check for isinstance(method, Callable) since there are scenarios where inspect.ismethod() fails for some reason
Diffstat (limited to 'cmd2')
-rw-r--r-- | cmd2/cmd2.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py index 25251bef..2215f818 100644 --- a/cmd2/cmd2.py +++ b/cmd2/cmd2.py @@ -432,7 +432,8 @@ class Cmd(cmd.Cmd): cmdset.on_register(self) methods = inspect.getmembers( cmdset, - predicate=lambda meth: inspect.ismethod(meth) and meth.__name__.startswith(COMMAND_FUNC_PREFIX)) + predicate=lambda meth: (inspect.ismethod(meth) or isinstance(meth, Callable)) and + meth.__name__.startswith(COMMAND_FUNC_PREFIX)) installed_attributes = [] try: |