Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork33.3k
Closed
Description
Bug report
Bug description:
This code:
importargparseparser=argparse.ArgumentParser()parser.add_argument("--broken")parser.add_argument("--working")args=parser.parse_args(["--broken=--","--working=asdf"])print(args)
prints:
$ podman run -v $(pwd):/src python:3.11.5-bookworm python /src/delim.py Namespace(broken=[], working='asdf')The value of the--broken argument is not parsed, presumably because it is the standard end-of-argument-list value. But this does not seem expected when the value is introduced with=. Besides, in this case, the parsing does continue for subsequent args, so it was not actually treated as end of arguments.
CPython versions tested on:
3.11, 3.12
Operating systems tested on:
Linux
Linked PRs
- gh-109475: argument get the value is
--#110959 - gh-109475: Fix support of explicit option value "--" in argparse #114814
- [3.12] gh-109475: Fix support of explicit option value "--" in argparse (GH-114814) #115036
- [3.11] gh-109475: Fix support of explicit option value "--" in argparse (GH-114814) #115037