[issue13824] argparse.FileType opens a file and never closes it

Mitar report at bugs.python.org
Wed May 8 01:58:55 EDT 2019


Mitar <mmitar at gmail.com> added the comment:

>  So it's already possible to do what you describe, simply by doing:

I think there is an edge case here if a stdin/stdout is opened? It would get closed at exist from the context, no?

So I suggest that a slight extension of what open otherwise returns is returned which make sure context manager applies only to non-stdin/stdout handles.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue13824>
_______________________________________


More information about the Python-bugs-list mailing list