[New-bugs-announce] [issue24754] argparse add_argument with action="store_true", type=bool should not crash

Douglas Bagnall report at bugs.python.org
Thu Jul 30 11:56:58 CEST 2015


New submission from Douglas Bagnall:

A line like this:

    parser.add_argument('--hello', action="store_true", type=bool)

causes a TypeError in 2.7 and 3.4:

   File "/usr/lib/python3.4/argparse.py", line 1344, in add_argument
     action = action_class(**kwargs)

     TypeError: __init__() got an unexpected keyword argument 'type'

It shouldn't really.

----------
components: Library (Lib)
files: argparse-crash.py
messages: 247658
nosy: dbagnall
priority: normal
severity: normal
status: open
title: argparse add_argument with action="store_true", type=bool should not crash
versions: Python 2.7, Python 3.4
Added file: http://bugs.python.org/file40065/argparse-crash.py

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


More information about the New-bugs-announce mailing list