Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

zlib.compress should have a wbits argument #87778

Closed
rhpvorderman mannequin opened this issue Mar 24, 2021 · 4 comments
Closed

zlib.compress should have a wbits argument #87778

rhpvorderman mannequin opened this issue Mar 24, 2021 · 4 comments
Labels
3.11 only security fixes extension-modules C modules in the Modules dir type-feature A feature request or enhancement

Comments

@rhpvorderman
Copy link
Mannequin

rhpvorderman mannequin commented Mar 24, 2021

BPO 43612
Nosy @ambv, @rhpvorderman
PRs
  • bpo-43612: Add wbits parameter to zlib.compress #25011
  • bpo-43613: Faster implementation of gzip.compress and gzip.decompress #27941
  • 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 = <Date 2021-09-02.15:03:42.859>
    created_at = <Date 2021-03-24.06:04:20.507>
    labels = ['extension-modules', 'type-feature', '3.11']
    title = 'zlib.compress should have a wbits argument'
    updated_at = <Date 2021-09-03.07:28:10.530>
    user = 'https://github.com/rhpvorderman'

    bugs.python.org fields:

    activity = <Date 2021-09-03.07:28:10.530>
    actor = 'rhpvorderman'
    assignee = 'none'
    closed = True
    closed_date = <Date 2021-09-02.15:03:42.859>
    closer = 'lukasz.langa'
    components = ['Extension Modules']
    creation = <Date 2021-03-24.06:04:20.507>
    creator = 'rhpvorderman'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 43612
    keywords = ['patch']
    message_count = 4.0
    messages = ['389437', '391881', '400922', '400982']
    nosy_count = 2.0
    nosy_names = ['lukasz.langa', 'rhpvorderman']
    pr_nums = ['25011', '27941']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue43612'
    versions = ['Python 3.11']

    @rhpvorderman
    Copy link
    Mannequin Author

    rhpvorderman mannequin commented Mar 24, 2021

    zlib.compress can now only be used to output zlib blocks.
    Arguably zlib.compress(my_data, level, wbits=-15) is even more useful as it gives you a raw deflate block. That is quite interesting if you are writing your own file format and want to use compression, but like to use a different hash.

    Also gzip.compress(data, level, mtime) is extremely slow due to it instantiating a GzipFile object which then streams a bytes object. Explicitly not taking advantage of the fact that the bytes object is entirely in memory already (I will create another bug for this). zlib.compress(my_data, level, wbits=31) should be faster in all possible circumstances, but that option is not available now.

    @rhpvorderman rhpvorderman mannequin added stdlib Python modules in the Lib dir 3.10 only security fixes type-feature A feature request or enhancement extension-modules C modules in the Modules dir and removed stdlib Python modules in the Lib dir labels Mar 24, 2021
    @rhpvorderman
    Copy link
    Mannequin Author

    rhpvorderman mannequin commented Apr 26, 2021

    A patch was created, but has not been reviewed yet.

    @rhpvorderman rhpvorderman mannequin added 3.11 only security fixes labels Apr 26, 2021
    @ambv
    Copy link
    Contributor

    ambv commented Sep 2, 2021

    Thanks for your contribution, Ruben! ✨ 🍰 ✨

    @ambv ambv closed this as completed Sep 2, 2021
    @ambv ambv closed this as completed Sep 2, 2021
    @ambv ambv removed 3.10 only security fixes labels Sep 2, 2021
    @rhpvorderman
    Copy link
    Mannequin Author

    rhpvorderman mannequin commented Sep 3, 2021

    Thanks for the review, Lukasz! It was fun to create the PR and optimize the performance for gzip.py as well.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.11 only security fixes extension-modules C modules in the Modules dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant