Message159594
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). |
|
Date |
User |
Action |
Args |
2012-04-29 09:41:03 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, r.david.murray, ryles, agillesp, BreamoreBoy |
2012-04-29 09:41:03 | serhiy.storchaka | set | messageid: <1335692463.66.0.480046984199.issue6759@psf.upfronthosting.co.za> |
2012-04-29 09:41:03 | serhiy.storchaka | link | issue6759 messages |
2012-04-29 09:41:02 | serhiy.storchaka | create | |
|