Author methane
Recipients methane
Date 2021-04-09.08:49:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
__iter__ method of BZ2File, GzipFile, and LZMAFile is IOBase.__iter__. It calls `readline()` for each line.

Since `readline()` is defined as Python function, it is slower than C iterator. Adding custom __iter__ method that delegates to underlying buffer __iter__ makes `for line in file` 2x faster.

    def __iter__(self):
        return self._buffer.__iter__()


The original issue is reported here.
This issue is relating to #43785.
Date User Action Args
2021-04-09 08:49:43methanesetrecipients: + methane
2021-04-09 08:49:43methanesetmessageid: <>
2021-04-09 08:49:42methanelinkissue43787 messages
2021-04-09 08:49:42methanecreate