[issue7610] Cannot use both read and readline method in same ZipExtFile object
Nir Aides
report at bugs.python.org
Tue Jan 5 08:10:39 CET 2010
Nir Aides <nir at winpdb.org> added the comment:
> Thank you. Are you sure the "Shortcut common case" in readline()
> is useful? BufferedIOBase.readline() in itself should be rather fast.
On my dataset the shortcut speeds up readline() 400% on top of the default C implementation.
I can take a look to why the C implementation is slow (although it is documented as "slowish").
> Also, I'm not sure what happens in readline() in universal mode when
> the chunk ends with a '\r' and there's a '\n' in the following chunk
> (see the "ugly check" that your patch removes). Is there a test for that?
The regular pattern returns either a line chunk or a newline (sequence) but not both. To read a line there is therefore a minimum of two peek() calls. One for the line content and the last for the newline. Since the peek is called with a value of 2, the newline sequence \r\n should be retrieved as is. There is no test for that.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue7610>
_______________________________________
More information about the Python-bugs-list
mailing list