[New-bugs-announce] [issue29715] Arparse improperly handles "-_"

Max Rothman report at bugs.python.org
Fri Mar 3 16:07:15 EST 2017


New submission from Max Rothman:

In the case detailed below, argparse.ArgumentParser improperly parses the argument string "-_":
```
import argparse

parser = argparse.ArgumentParser()
parser.add_argument('first')
print(parser.parse_args(['-_']))
```

Expected behavior: prints Namespace(first='-_')
Actual behavior: prints usage message

The issue seems to be specific to the string "-_". Either character alone or both in the opposite order does not trigger the issue.

----------
components: Library (Lib)
messages: 288929
nosy: Max Rothman
priority: normal
severity: normal
status: open
title: Arparse improperly handles "-_"
type: behavior
versions: Python 3.6

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue29715>
_______________________________________


More information about the New-bugs-announce mailing list