[New-bugs-announce] [issue27037] Universal newline support for zipFile.ZipExtFile.read() is not working (deprecated?), and the missing functionality not documented

David Pitchford report at bugs.python.org
Mon May 16 10:46:54 EDT 2016


New submission from David Pitchford:

Universal newline support for the read method of ZipFileExt objects created by calling the ZipFile.open method is not working. The attached archive contains a test script for demonstrating the behavior; unzip the files into the same directory and run the script. It tests opening a text file with all three types of line endings in five different ways: with the file.read method in modes 'rU', 'r', and 'rb', and with the zipfile.ZipFileExt.read and readlines methods in mode 'rU'.

The first two and last methods both read the file with the expected universal newline support; the '\r' and '\r\n' endings are translated to '\n'. But zipfile.ZipFileExt.read, even with universal newline support, leaves these endings untouched, just like the 'rb' mode.

This issue seems to have been raised in the past (http://bugs.python.org/issue6759) for Python 3.3, with the decision apparently made to deprecate universal newline support for this method. Is this also the case for Python 2.7, and if so, why does the zipfile documentation for both versions not mention this missing functionality? As a user, I can say that this deprecation is certainly disrupting my workflow; it is not at all the behavior I expected.

I am running Python 2.7.11 on a 64-bit copy of Windows 7 Professional SP1.

----------
components: Library (Lib)
files: TestNewlines.zip
messages: 265697
nosy: David Pitchford
priority: normal
severity: normal
status: open
title: Universal newline support for zipFile.ZipExtFile.read() is not working (deprecated?), and the missing functionality not documented
type: behavior
versions: Python 2.7
Added file: http://bugs.python.org/file42873/TestNewlines.zip

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


More information about the New-bugs-announce mailing list