This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients BreamoreBoy, agillesp, r.david.murray, ryles, serhiy.storchaka
Date 2012-04-29.09:41:02
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1335692463.66.0.480046984199.issue6759@psf.upfronthosting.co.za>
In-reply-to
Content
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).
History
Date User Action Args
2012-04-29 09:41:03serhiy.storchakasetrecipients: + serhiy.storchaka, r.david.murray, ryles, agillesp, BreamoreBoy
2012-04-29 09:41:03serhiy.storchakasetmessageid: <1335692463.66.0.480046984199.issue6759@psf.upfronthosting.co.za>
2012-04-29 09:41:03serhiy.storchakalinkissue6759 messages
2012-04-29 09:41:02serhiy.storchakacreate