STINNER Victor <vstin...@python.org> added the comment:

> Thankfully we don't need universal newlines, but no matter if we need them, 
> old versions of Samba will fail to build without a fix-up patch.

io.open() is available since Python 2.6 and handles different kinds of newlines 
transparently. Example:

$ python2
Python 2.7.17 (default, Oct 20 2019, 00:00:00) 
>>> f=open("test", "wb"); f.write("a\rb\rc\r"); f.close()
>>> import io; f=io.open("test"); lines=list(f); f.close(); lines
[u'a\n', u'b\n', u'c\n']

Do you suggest to change the documentation to suggest to open io.open() for 
applications which still care about Python 2?
https://docs.python.org/dev/whatsnew/3.9.html#changes-in-the-python-api

Note: Python 2 is no longer supported upstream, I strongly advice you to 
upgrade to Python 3.

----------

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

Reply via email to