[issue5148] gzip.open breaks with 'U' flag

Art Gillespie report at bugs.python.org
Thu Aug 27 17:42:11 CEST 2009


Art Gillespie <agillesp at gmail.com> added the comment:

The problem appears to be that the gzip module simply doesn't support
universal newlines yet.

I'm currently working on the zipfile module's universal newline support
(issue6759) so if nobody else is working on this, I'll do it.

I'm not sure if file object's open() behavior when presented with 'rUb'
is correct or not.

>>> f = open("test.txt", "w").write("blah\r\nblah\rblah\nblah\r\n")
>>> f = open("test.txt", "rUb")
>>> f.read()
'blah\nblah\nblah\nblah\n'

Since 'U' and 'b' are conceptually mutually exclusive on platforms where
'b' matters, I can see this being confusing.

----------
nosy: +agillesp

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue5148>
_______________________________________


More information about the Python-bugs-list mailing list