Skip to content

zipfile ignores deflate level settings in zipinfo object #64093

Closed as duplicate

Description

@rmilne
mannequin
BPO 19894
Nosy @serhiy-storchaka, @bbayles
Files
  • zipfileinfo.diff: Docs, tests and module patch against current tip of 2.7 branch (ae9fb85ab4e0 ?)
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = None
    created_at = <Date 2013-12-05.09:26:49.418>
    labels = ['type-feature', 'library']
    title = 'zipfile ignores deflate level settings in zipinfo object'
    updated_at = <Date 2018-02-25.23:28:20.276>
    user = 'https://bugs.python.org/rmilne'

    bugs.python.org fields:

    activity = <Date 2018-02-25.23:28:20.276>
    actor = 'bbayles'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2013-12-05.09:26:49.418>
    creator = 'rmilne'
    dependencies = []
    files = ['32984']
    hgrepos = []
    issue_num = 19894
    keywords = ['patch']
    message_count = 4.0
    messages = ['205284', '206414', '245747', '312869']
    nosy_count = 6.0
    nosy_names = ['alanmcintyre', 'docs@python', 'jens', 'serhiy.storchaka', 'rmilne', 'bbayles']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'needs patch'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue19894'
    versions = ['Python 3.5']

    Activity

    1. rmilne commented on Dec 5, 2013

      rmilnemannequin
      MannequinAuthor

      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.

    2. added
      type-bugAn unexpected behavior, bug, or error
      docsDocumentation in the Doc dir
      testsTests in the Lib/test dir
      stdlibStandard Library Python modules in the Lib/ directory
      on Dec 5, 2013
    3. serhiy-storchaka commented on Dec 17, 2013

      @serhiy-storchaka
      Member

      This is new feature and can be added only in 3.5.

    4. removed
      docsDocumentation in the Doc dir
      testsTests in the Lib/test dir
      on Dec 17, 2013
    5. added
      type-featureA feature request or enhancement
      and removed
      type-bugAn unexpected behavior, bug, or error
      on Dec 17, 2013
    6. jens commented on Jun 24, 2015

      jensmannequin
      Mannequin

      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.

    7. bbayles commented on Feb 25, 2018

      bbaylesmannequin
      Mannequin

      This was fixed in bpo-21417, in Github PR 5385:

      #5385

    8. transferred this issue fromon Apr 10, 2022
    9. thatch commented on May 20, 2025

      @thatch
      Contributor

      @gpshead Dupe of #65616 as noted above. I think that's a better API than reading the zipinfo flag bits.

    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

    Metadata

    Metadata

    Assignees

    No one assigned

      Labels

      stdlibStandard Library Python modules in the Lib/ directorytype-featureA feature request or enhancement

      Projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions