From cdac5516750e3b80b846e0e156e496dd92be9b56 Mon Sep 17 00:00:00 2001 From: Eli Bendersky Date: Fri, 6 Sep 2013 06:49:15 -0700 Subject: Issue #18920: argparse's default version action (for -v, --version) should output to stdout, matching the 'python -v' Reported by Wolfgang Maier --- Lib/argparse.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Lib/argparse.py') diff --git a/Lib/argparse.py b/Lib/argparse.py index 5ff755c84ab..9520e0ea7c6 100644 --- a/Lib/argparse.py +++ b/Lib/argparse.py @@ -1037,7 +1037,8 @@ class _VersionAction(Action): version = parser.version formatter = parser._get_formatter() formatter.add_text(version) - parser.exit(message=formatter.format_help()) + parser._print_message(formatter.format_help(), _sys.stdout) + parser.exit() class _SubParsersAction(Action): -- cgit v1.2.3