paul j3 added the comment:

There are a couple of complications to using 'fileno'.

We probably don't want to close 'sys.stdin' or 'sys.stdout' (not even if they 
are redirected to other files?).  That means using:

    open(sys.stdin.fileno(), ..., closefd=False)

'closefd', on the other hand, has to be True for string file specifications.

But in 'test_argparse.py', 'sys.stdout' is redirected to an 'io.StringIO'.  
This has many of the same features as an open file, but 'fileno' is not 
implemented.  So the TypeFile probably needs to make an exception for this 
case.  I don't how this will play with a 'BytesIO' for 'wb' cases.

----------

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

Reply via email to