Serhiy Storchaka <storch...@gmail.com> added the comment:

Support lines in zipfile looks contradictory and buggy. This complicates the 
code and makes the behavior of zipfile.ZipExtFile incompatible with the 
interface of other file-like objects. For example, the behavior of the read, 
read1 and peek differ from one described in io module.

If we are working with binary data, conversion of newlines is meaningless (and 
how about newlines in comments?). If we are working with text, the bytes must 
be decoded to str. This will help io.TextIOWrapper.

I suggest two alternatives:

1. Deprecate universal newline support in zipfile. zipfile.ZipExtFile should 
always work with non-modified bytes, and who need the text, let wraps 
zipfile.ZipExtFile with io.TextIOWrapper.

2. Automatically wrap a zipfile.ZipExtFile with io.TextIOWrapper if universal 
newlines mode is enabled. In this case, the data type will change from bytes to 
str. Add modes "t" and "b" to explicitly specify the data type. Add an encoding 
parameter (and other parameters if needed).

----------
nosy: +storchaka

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

Reply via email to