This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: argparse subparsers break without arguments
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.3, Python 3.4
process
Status: closed Resolution: duplicate
Dependencies: Superseder: Undocumented (?) behaviour change in argparse from 3.2.3 to 3.3.0
View: 16308
Assigned To: Nosy List: SilentGhost, bethard, maker, r.david.murray
Priority: normal Keywords: 3.3regression

Created on 2013-05-01 14:38 by SilentGhost, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
test.py SilentGhost, 2013-05-01 14:38
Messages (1)
msg188228 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2013-05-01 14:38
If you run attached file w/ 3.2 and 3.3 (and later) versions, you'll notice that the new version of parser doesn't handle empty argument list:

$ python3.2 test.py
usage: test.py [-h] {demo} ...
test.py: error: too few arguments
$ python3.3 test.py
Namespace()

Everything is naturally failing in 3.3 version as the execution continues with the empty Namespace. I suspect this is due to the issue10424 that removed explicit check for positionals.
History
Date User Action Args
2022-04-11 14:57:45adminsetgithub: 62089
2013-05-01 17:09:47r.david.murraysetstatus: open -> closed
superseder: Undocumented (?) behaviour change in argparse from 3.2.3 to 3.3.0
resolution: duplicate
stage: resolved
2013-05-01 15:07:56SilentGhostsettitle: argparse subparsers break without without argument -> argparse subparsers break without arguments
2013-05-01 14:38:47SilentGhostcreate