summaryrefslogtreecommitdiffstats
path: root/Lib/test/libregrtest
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-10-17 16:13:46 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-10-17 16:13:46 (GMT)
commita506a93b0b6602be1613cee752d62feca41bee24 (patch)
tree29003379929d7b3b3908a0e2df273d8c2b44a0bd /Lib/test/libregrtest
parent066b1217af161f30b206e77bffb491e0fa9a4579 (diff)
parent1f6b69b74996164be5f13dea34242edc14bd87a1 (diff)
downloadcpython-a506a93b0b6602be1613cee752d62feca41bee24.zip
cpython-a506a93b0b6602be1613cee752d62feca41bee24.tar.gz
cpython-a506a93b0b6602be1613cee752d62feca41bee24.tar.bz2
Merge 3.6: Issue #28409: regrtest: fix the parser of command line arguments.
Diffstat (limited to 'Lib/test/libregrtest')
-rw-r--r--Lib/test/libregrtest/cmdline.py11
1 files changed, 7 insertions, 4 deletions
diff --git a/Lib/test/libregrtest/cmdline.py b/Lib/test/libregrtest/cmdline.py
index c9e2f3d..891b00c 100644
--- a/Lib/test/libregrtest/cmdline.py
+++ b/Lib/test/libregrtest/cmdline.py
@@ -242,9 +242,6 @@ def _create_parser():
group.add_argument('-P', '--pgo', dest='pgo', action='store_true',
help='enable Profile Guided Optimization training')
- parser.add_argument('args', nargs='*',
- help=argparse.SUPPRESS)
-
return parser
@@ -294,7 +291,13 @@ def _parse_args(args, **kwargs):
ns.use_resources = []
parser = _create_parser()
- parser.parse_args(args=args, namespace=ns)
+ # Issue #14191: argparse doesn't support "intermixed" positional and
+ # optional arguments. Use parse_known_args() as workaround.
+ ns.args = parser.parse_known_args(args=args, namespace=ns)[1]
+ for arg in ns.args:
+ if arg.startswith('-'):
+ parser.error("unrecognized arguments: %s" % arg)
+ sys.exit(1)
if ns.single and ns.fromfile:
parser.error("-s and -f don't go together!")