[issue6759] zipfile.ZipExtFile.read() is missing universal newline support

R. David Murray report at bugs.python.org
Wed Aug 26 20:55:45 CEST 2009


R. David Murray <rdmurray at bitdance.com> added the comment:

Thanks for working on this.

Comments on patch:

(1) I think you should retain the full "ugly check" comment explaining
how the \r\n spanning a buffer is handled.  I think that's a helpful
explanation for a non-obvious piece of code.

(2) Your code for setting the newlines attributes and the tests for it
look wrong to me.  The attribute is supposed to list all separators
seen.  I think your code is going to set it to ('\r\n', '\r') when the
separators are just '\r\n', and your test doesn't check to make sure
newlines gets set to _only_ what was seen.  (Nor does it check for the
case of actual mixed line endings...a test for which would require some
additional test hackery since the existing test code didn't try to test
mixed line end files either.)

(3) Sorry for being dense, but I don't understand your code to adjust
the number of bytes in the read method or the test that tests it.  I
haven't tried to play with it, but it looks odd to me that you'd be
adding '2', since I would think that the read could cover more than one
line...or am I misunderstanding how 'read(n)' works (which is entirely
possible)?

----------

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


More information about the Python-bugs-list mailing list