Eryk Sun <eryk...@gmail.com> added the comment:

> we'd have to reimplement the UCRT function using the system API. 

Could the implementation drop support for os.O_TEXT? I think Python 3 should 
have removed both os.O_TEXT and os.O_BINARY. 3.x has no need for the C 
runtime's ANSI text mode, with its Ctrl+Z behavior inherited from MS-DOS. I'd 
prefer that os.open always used _O_BINARY and raised a ValueError if passed any 
of the C runtime's text modes, including _O_TEXT, _O_WTEXT, _O_U16TEXT, and 
_O_U8TEXT.

If _O_TEXT is supported, then we have to copy the C runtime's behavior, which 
truncates a Ctrl+Z from the end of the file if it's opened with read-write 
access. If Unicode text modes are supported, then we have to read the BOM, 
which can involve opening the file twice if the caller doesn't request read 
access.

----------

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

Reply via email to