summaryrefslogtreecommitdiff
path: root/cmd2/cmd2.py
diff options
context:
space:
mode:
authorKevin Van Brunt <kmvanbrunt@gmail.com>2020-08-25 11:25:00 -0400
committerGitHub <noreply@github.com>2020-08-25 11:25:00 -0400
commitae7e67c20217baaa17e6d182a3fd33b9e8c982e8 (patch)
treeb8cfbaca2ec4622a981d96c33c7a964ca621108e /cmd2/cmd2.py
parenta540cfc5373cee2272de6c81be8b6fa8a78c6462 (diff)
parent9b5a98825a9b00807a40494e8c634c392077ccd2 (diff)
downloadcmd2-git-ae7e67c20217baaa17e6d182a3fd33b9e8c982e8.tar.gz
Merge pull request #984 from python-cmd2/recursion_error
Fixed RecursionError when printing an argparse.Namespace
Diffstat (limited to 'cmd2/cmd2.py')
-rw-r--r--cmd2/cmd2.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/cmd2/cmd2.py b/cmd2/cmd2.py
index da576805..bc6691f6 100644
--- a/cmd2/cmd2.py
+++ b/cmd2/cmd2.py
@@ -663,7 +663,9 @@ class Cmd(cmd.Cmd):
raise CommandSetRegistrationError('Could not find argparser for command "{}" needed by subcommand: {}'
.format(command_name, str(method)))
- subcmd_parser.set_defaults(cmd2_handler=method)
+ # Set the subcommand handler function
+ defaults = {constants.NS_ATTR_SUBCMD_HANDLER: method}
+ subcmd_parser.set_defaults(**defaults)
def find_subcommand(action: argparse.ArgumentParser, subcmd_names: List[str]) -> argparse.ArgumentParser:
if not subcmd_names: