Roundup Robot added the comment:
New changeset 1b614921aefa by R David Murray in branch '3.2':
#12776,#11839: call argparse type function only once.
http://hg.python.org/cpython/rev/1b614921aefa
New changeset 74f6d87cd471 by R David Murray in branch 'default':
Merge #12776,#11839: call argparse
Changes by Paolo Elvati elv...@umich.edu:
--
resolution: - duplicate
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11839
___
Changes by Paolo Elvati elv...@umich.edu:
--
status: closed - open
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11839
___
___
Python-bugs-list
Changes by Paolo Elvati elv...@umich.edu:
--
status: open - closed
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11839
___
___
Python-bugs-list
Mike Meyer m...@mired.org added the comment:
Steven - 12776 indeed fixes this issue. I applied the patch from it to a build
of todays checkout, verified that my simple test script worked, then wrote some
test cases for test_argparse.
I've uploaded the patch for that test to both issues. I
Steven Bethard steven.beth...@gmail.com added the comment:
I think Issue 12776, which delays type conversions on defaults, should solve
this problem, right? If you agree, could you add your code here as a test case
to that issue and mark this as duplicate?
--
Stefan Pfeiffer stefan.pfeif...@gmail.com added the comment:
Happens in 3.2, too...
Would be nice to see that fixed.
Stefan
--
nosy: +Stefan.Pfeiffer
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue11839
Manveru manv...@manveru.pl added the comment:
I have the same issue with default here with 2.7.
Fortunately I have my own type function so I can prevent is by changing my
internal state. This is however only a workaround for real bug in the argparse.
--
nosy: +manveru
versions:
New submission from Paolo Elvati elv...@umich.edu:
Hi,
when a default is specified for a file argument that is open with writing
permission (FileType('w')), the default file is always created even if the
argument is specified in the command line.
For example he code:
import argparse
parser