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)
commit03937a8755e189959c44e5035a3eb27db95a6efe (patch)
tree3e2e9bf17f4ea99ba36e9ebd32cd32fecfaed8cd /Lib/argparse.py
parentdfaf90da9c4a9a4f7dd7bd716fa0695d32bbd91f (diff)
downloadcpython-03937a8755e189959c44e5035a3eb27db95a6efe.zip
cpython-03937a8755e189959c44e5035a3eb27db95a6efe.tar.gz
cpython-03937a8755e189959c44e5035a3eb27db95a6efe.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 440d8fa..30bae57 100644
--- a/Lib/argparse.py
+++ b/Lib/argparse.py
@@ -1948,7 +1948,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,