summaryrefslogtreecommitdiffstats
path: root/Lib/argparse.py
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2012-09-12 18:34:50 (GMT)
committerBarry Warsaw <barry@python.org>2012-09-12 18:34:50 (GMT)
commiteaae1b76aecd2c2fc1cf1aa1578db69e7d1464e6 (patch)
tree3ce66cbfcb96f3492675f56fe45a87a18abfd785 /Lib/argparse.py
parent55ad6515c90148bbcaeee0d7a185bfecc9aa1693 (diff)
downloadcpython-eaae1b76aecd2c2fc1cf1aa1578db69e7d1464e6.zip
cpython-eaae1b76aecd2c2fc1cf1aa1578db69e7d1464e6.tar.gz
cpython-eaae1b76aecd2c2fc1cf1aa1578db69e7d1464e6.tar.bz2
A follow up for issue #15906: change the test for calling the type conversion
on the action's default, reverting it back to previous behavior. Conversion is only done on string defaults. Add a test for this and another test that ensures such type conversions are only called once.
Diffstat (limited to 'Lib/argparse.py')
-rw-r--r--Lib/argparse.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/Lib/argparse.py b/Lib/argparse.py
index fba6a26..e2677f8 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -1957,7 +1957,7 @@ class ArgumentParser(_AttributeHolder, _ActionsContainer):
# twice (which may fail) if the argument was given, but
# only if it was defined already in the namespace
if (action.default is not None and
- isinstance(action, _StoreAction) and
+ isinstance(action.default, basestring) and
hasattr(namespace, action.dest) and
action.default is getattr(namespace, action.dest)):
setattr(namespace, action.dest,