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 serhiy.storchaka
Recipients alanmcintyre, benjamin.peterson, nadeem.vawda, pitrou, serhiy.storchaka, stutzbach
Date 2013-09-19.14:22:05
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1379600529.46.0.258828532264.issue19051@psf.upfronthosting.co.za>
In-reply-to
Content
There are some classes in gzip, bz2, lzma, and zipfile modules which implement buffered reader interface. They read chunks of data from underlied file object, decompress it, save in internal buffer, and provide common methods to read from this buffer. Maintaining of duplicated code is cumbersome and error prone. Proposed preliminary patch moves common code into new private class _io2._BufferedReaderMixin. If the proposition will be accepted in general, I'm going to write C version and move it into the io module. Perhaps even then merge it with io.BufferedIOBase.

The idea is that all buffered reading functions (read(), read1(), readline(), peek(), etc) can be expressed in the term of one function which returns raw unbuffered data. Subclasses need define only one such function and will got all buffered reader interface. In case of mentioned above classes this functions reads and decompresses a chunk of data from underlied file. The HTTPResponse class perhaps will benefit too (issue19009).
History
Date User Action Args
2013-09-19 14:22:10serhiy.storchakasetrecipients: + serhiy.storchaka, alanmcintyre, pitrou, nadeem.vawda, benjamin.peterson, stutzbach
2013-09-19 14:22:09serhiy.storchakasetmessageid: <1379600529.46.0.258828532264.issue19051@psf.upfronthosting.co.za>
2013-09-19 14:22:09serhiy.storchakalinkissue19051 messages
2013-09-19 14:22:09serhiy.storchakacreate