Index: Lib/test/test_argparse.py =================================================================== --- Lib/test/test_argparse.py (revision 83675) +++ Lib/test/test_argparse.py (working copy) @@ -106,7 +106,10 @@ code = sys.exc_info()[1].code stdout = sys.stdout.getvalue() stderr = sys.stderr.getvalue() - raise ArgumentParserError("SystemExit", stdout, stderr, code) + # Avoid exception chaining, which produces a confusing error + # if the raise is not expected, by delaying the raise. + exc = ArgumentParserError("SystemExit", stdout, stderr, code) + raise exc finally: sys.stdout = old_stdout sys.stderr = old_stderr