[issue12776] argparse: type conversion function should be called only once

Arnaud Fontaine report at bugs.python.org
Fri Nov 25 06:34:55 CET 2011


Arnaud Fontaine <arnau at debian.org> added the comment:

I have had a look at the issue more closely and my initial patch was not completely right as it didn't work properly with argparse_test.py despite all tests passing.

Therefore, I have amended my patch to not check whether action.default was a basestring which didn't make sense at all, but check instead if action.default is None (action.default default value is None if not given to add_argument as far as I understand). I also added a test for the issue reported above as it was missing and ran patchcheck to make sure everything was fine. All the tests (include argparse_test.py) passes without problem.

Could you please apply them? Many thanks.

----------

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


More information about the Python-bugs-list mailing list