This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients Arfrever, Michael.Fox, eric.araujo, larry, martin.panter, nadeem.vawda, pitrou, rhettinger, serhiy.storchaka, vstinner
Date 2015-06-10.03:07:24
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1433905645.22.0.923846653636.issue18003@psf.upfronthosting.co.za>
In-reply-to
Content
The BufferedReader class is documented as being thread safe: <https://docs.python.org/dev/library/io.html#multi-threading>. Some experimentation suggests that checking the “raw.closed” property is not actually serialized, but that raw.readinto() calls are serialized. I don’t think this is a big problem in practice, so I think BZ2File would remain as thread-safe as BufferedReader is.

But Serhiy’s point is definitely valid about the classes breaking the iterator protocol. FWIW I originally made this patch to satisfy my personal curiosity about why wrapping a second BufferedReader made things so much faster. Now I accept it is partly due to the overhead of the extra LZMAFile.readline() to BufferedReader.readline() delegation. Maybe it is not even worth optimizing around this kind of overhead, so I would even be happy to drop this patch and close the issue.
History
Date User Action Args
2015-06-10 03:07:25martin.pantersetrecipients: + martin.panter, rhettinger, pitrou, vstinner, larry, nadeem.vawda, eric.araujo, Arfrever, serhiy.storchaka, Michael.Fox
2015-06-10 03:07:25martin.pantersetmessageid: <1433905645.22.0.923846653636.issue18003@psf.upfronthosting.co.za>
2015-06-10 03:07:25martin.panterlinkissue18003 messages
2015-06-10 03:07:24martin.pantercreate