You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
zipfile ignores deflate level settings in zipinfo object #64093
Reading the pkzip APPNOTE and the documentation for the zipfile module, I was under the impression that I could set the DEFLATE compression level, on a per-file basis, for each file added to an archive, by setting the appropriate bits in zipinfo.flag_bits.
You can't. Hence the attached patch, which updates the docs, tests and module source to enables this ability and makes the user aware of it.
Activity
rmilne commentedon Dec 5, 2013
Reading the pkzip APPNOTE and the documentation for the zipfile module, I was under the impression that I could set the DEFLATE compression level, on a per-file basis, for each file added to an archive, by setting the appropriate bits in zipinfo.flag_bits.
You can't. Hence the attached patch, which updates the docs, tests and module source to enables this ability and makes the user aware of it.
serhiy-storchaka commentedon Dec 17, 2013
This is new feature and can be added only in 3.5.
jens commentedon Jun 24, 2015
IMHO it should be possible to set compression level not only for DEFLATE.
And it should be similar with the tarfile API.
Seems that http://bugs.python.org/issue21417 will cover this.
bbayles commentedon Feb 25, 2018
This was fixed in bpo-21417, in Github PR 5385:
#5385
thatch commentedon May 20, 2025
@gpshead Dupe of #65616 as noted above. I think that's a better API than reading the zipinfo flag bits.