[issue11839] argparse: unexpected behavior of default for FileType('w')

2012-08-31 Thread Roundup Robot

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 type function only once.
http://hg.python.org/cpython/rev/74f6d87cd471

New changeset 62b5667ef2f4 by R David Murray in branch '2.7':
#12776,#11839: call argparse type function only once.
http://hg.python.org/cpython/rev/62b5667ef2f4

--
nosy: +python-dev

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11839] argparse: unexpected behavior of default for FileType('w')

2012-05-03 Thread Paolo Elvati

Changes by Paolo Elvati :


--
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11839] argparse: unexpected behavior of default for FileType('w')

2012-05-03 Thread Paolo Elvati

Changes by Paolo Elvati :


--
status: closed -> open

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11839] argparse: unexpected behavior of default for FileType('w')

2012-05-03 Thread Paolo Elvati

Changes by Paolo Elvati :


--
resolution:  -> duplicate
status: open -> closed

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11839] argparse: unexpected behavior of default for FileType('w')

2012-05-02 Thread Mike Meyer

Mike Meyer  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 can't close this as a 
duplicate, though.

--
nosy: +Mike.Meyer
Added file: http://bugs.python.org/file25439/fopatch

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11839] argparse: unexpected behavior of default for FileType('w')

2011-12-15 Thread Steven Bethard

Steven Bethard  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?

--

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11839] argparse: unexpected behavior of default for FileType('w')

2011-05-02 Thread Stefan Pfeiffer

Stefan Pfeiffer  added the comment:

Happens in 3.2, too...

Would be nice to see that fixed.

Stefan

--
nosy: +Stefan.Pfeiffer

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11839] argparse: unexpected behavior of default for FileType('w')

2011-04-27 Thread Manveru

Manveru  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: +Python 2.7

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue11839] argparse: unexpected behavior of default for FileType('w')

2011-04-12 Thread Paolo Elvati

New submission from Paolo Elvati :

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 = argparse.ArgumentParser() 
parser.add_argument( 
"-o", 
default = 'fake', 
dest = 'OutputFile', 
type = argparse.FileType('w') 
) 
args = parser.parse_args() 

will create the empty file "fake" even if the -o option is given. 
The value inside the code of args.Outputfile is not affected.

Paolo

--
components: Library (Lib)
messages: 133598
nosy: Paolo.Elvati, bethard
priority: normal
severity: normal
status: open
title: argparse: unexpected behavior of default for FileType('w')
type: behavior
versions: Python 3.2

___
Python tracker 

___
___
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com