New submission from bbayles <bbay...@gmail.com>:

In [1] (issue 21417), support for setting an archive (or its files) compression 
level was added to the zipfile module.

That currently works for the ZIP_DEFLATED and ZIP_BZIP2 compression methods, 
but not for ZIP_LZMA. This is because zipfile includes its own implementation 
of LZMACompressor that hard-codes the default preset's parameters (see also 
[2]).

It should be possible to extend compression level settings to ZIP_LZMA by 
making zipfile.LZMACompressor more flexible, i.e. able to accept an LZMA 
preset. I think this would involve porting the function that translates presets 
to options (lzma_lzma_preset, see [3]) and passing in those options to 
lzma.LZMACompressor .

[1] https://bugs.python.org/issue21417
[2] https://github.com/python/cpython/pull/5385
[3] 
https://git.tukaani.org/?p=xz.git;a=blob;f=src/liblzma/lzma/lzma_encoder_presets.c;hb=HEAD

----------
components: Library (Lib)
messages: 311283
nosy: bbayles
priority: normal
severity: normal
status: open
title: Extend zipfile's compression level support  to LZMA
type: enhancement
versions: Python 3.8

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue32728>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to