Message363247
> 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. |
|
Date |
User |
Action |
Args |
2020-03-03 09:15:47 | vstinner | set | recipients:
+ vstinner, pitrou, serhiy.storchaka, Anthony Sottile, miss-islington, abartlet |
2020-03-03 09:15:47 | vstinner | set | messageid: <1583226947.93.0.382040094246.issue37330@roundup.psfhosted.org> |
2020-03-03 09:15:47 | vstinner | link | issue37330 messages |
2020-03-03 09:15:47 | vstinner | create | |
|