[issue9347] Calling argparse add_argument with a sequence as 'type' causes spurious error message
Roundup Robot devnull@devnull added the comment: New changeset f961e9179998 by Steven Bethard in branch '2.7': Issue #9347: Fix formatting for tuples in argparse type= error messages. http://hg.python.org/cpython/rev/f961e9179998 New changeset 69ab5251f3f0 by Steven Bethard in branch '3.2': Issue #9347: Fix formatting for tuples in argparse type= error messages. http://hg.python.org/cpython/rev/69ab5251f3f0 New changeset 1f3f6443810a by Steven Bethard in branch 'default': Issue #9347: Fix formatting for tuples in argparse type= error messages. http://hg.python.org/cpython/rev/1f3f6443810a -- nosy: +python-dev ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9347 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9347] Calling argparse add_argument with a sequence as 'type' causes spurious error message
Changes by Steven Bethard steven.beth...@gmail.com: -- assignee: - bethard resolution: - fixed stage: needs patch - committed/rejected status: open - closed versions: +Python 3.3 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9347 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com
[issue9347] Calling argparse add_argument with a sequence as 'type' causes spurious error message
New submission from Steven Bethard steven.beth...@gmail.com: What steps will reproduce the problem? parser = argparse.ArgumentParser() parser.add_argument('--foo', type=(int, float)) What is the expected output? ValueError: (type 'int', type 'float') is not callable What do you see instead? TypeError: not all arguments converted during string formatting Please provide any additional information below. This is caused by calling using the % string formatting operator without proper wrapping of the argument. The fix is basically: -raise ValueError('%r is not callable' % type_func) +raise ValueError('%r is not callable' % (type_func,)) -- components: Library (Lib) messages: 111316 nosy: bethard priority: low severity: normal stage: needs patch status: open title: Calling argparse add_argument with a sequence as 'type' causes spurious error message type: behavior versions: Python 2.7, Python 3.2 ___ Python tracker rep...@bugs.python.org http://bugs.python.org/issue9347 ___ ___ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com