paul j3 added the comment:

Related issues are:

http://bugs.python.org/issue13824 - argparse.FileType opens a file and never 
closes it
http://bugs.python.org/issue14156 - argparse.FileType for '-' doesn't work for 
a mode of 'rb'

As discussed earlier FileType was meant as a convenience for small scripting 
applications, ones that don't try to close the file before exiting.

But now we are encouraged to open files in a context that guarantees closure.  
In 13824 I proposed a 'FileContext', and included a dummy context like this 
handle stdin/out.

But I think the closefd=False approach raised in 14156 and David is probably 
the better way to go.

I think the main thing that is lacking is a testing mechanism.

----------
nosy: +paul.j3

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue22884>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to