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, martin.panter, nikratio, pitrou, serhiy.storchaka
Date 2015-03-07.07:18:40
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1425712723.97.0.267984627537.issue23529@psf.upfronthosting.co.za>
In-reply-to
Content
I am posting LZMAFile-etc.v3.patch, where I have implemented a “buffer_size” parameter to the buffered LZMAFile etc classes. I have not implemented open(buffering=...) for the time being (which should probably delegate to the buffer_size parameter or return a raw _DecompressReader object, at least for read mode). Other changes:

* Restored the _MODE_WRITE = 3 value
* Explained the _pos and _size attributes in _DecompressReader
* Factored out decomp_factory and args, decomp_error parameters to make _DecompressReader generic
* BZ2File modified similarly to LZMAFile
* I removed the deprecated and unused BZ2File(buffering=...) parameter; buffer_size takes its place. The old buffering parameter appears to have been documented, but never implemented in C Python, so hopefully this is not a big deal.

Still to do: Need to find a better home for the _DecompressReader and _BaseStream classes. Currently it lives in “lzma”, but apparently it is possible for any of the gzip, bz2, lzma modules to not be importable, so it would have to live elsewhere. Possible options are the io module, or a brand new internal module (e.g. Lib/_compression.py). Thoughts?

Also I am about to see if I can make GzipFile use the _DecompressReader class. I will have to add GzipFile(buffer_size=...) as a keyword-only parameter since the third parameter position is already taken. There are quite a few quirks with gzip and zlib compared to bz2 and lzma, so I will see how I go.
History
Date User Action Args
2015-03-07 07:18:44martin.pantersetrecipients: + martin.panter, pitrou, Arfrever, nikratio, serhiy.storchaka
2015-03-07 07:18:43martin.pantersetmessageid: <1425712723.97.0.267984627537.issue23529@psf.upfronthosting.co.za>
2015-03-07 07:18:43martin.panterlinkissue23529 messages
2015-03-07 07:18:43martin.pantercreate