[issue7610] Cannot use both read and readline method in same ZipExtFile object

Antoine Pitrou report at bugs.python.org
Tue Jan 5 11:58:28 CET 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

> Since the peek is called with a value of 2, the newline sequence \r\n
> should be retrieved as is.

No, it doesn't follow. The \r can still appear at the end of a readahead, in which case your algorithm will not eliminate the following \n.

That is, if the sequence of readaheads is ['a\r', '\nb\n'], readlines() will return ['a\n', '\n', 'b\n'] while it should return ['a\n', 'b\n'].

It should be possible to construct a statistically valid test case for this, for example by creating an archived file containing 'a\r\n'*10000 and reading back from it.

----------

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


More information about the Python-bugs-list mailing list