X Tutup
The Wayback Machine - https://web.archive.org/web/20260404121719/https://github.com/python/cpython/pull/102017
Skip to content

ZipFile: allow setting compress_type/compresslevel in open() as well#102017

Closed
obfusk wants to merge 2 commits intopython:mainfrom
obfusk:zipfile-open-compresslevel
Closed

ZipFile: allow setting compress_type/compresslevel in open() as well#102017
obfusk wants to merge 2 commits intopython:mainfrom
obfusk:zipfile-open-compresslevel

Conversation

@obfusk
Copy link
Copy Markdown
Contributor

@obfusk obfusk commented Feb 18, 2023

Currently, you can set compress_type/compresslevel when writing a ZIP entry with write() or writestr() but not when writing via open(); this PR fixes that.

@obfusk obfusk force-pushed the zipfile-open-compresslevel branch from 7b20705 to 97776b6 Compare February 18, 2023 01:21
@arhadthedev arhadthedev added the stdlib Standard Library Python modules in the Lib/ directory label Feb 18, 2023
@serhiy-storchaka serhiy-storchaka added the pending The issue will be closed if no feedback is provided label Jan 16, 2024
@serhiy-storchaka
Copy link
Copy Markdown
Member

You can create a ZipInfo object, set its compress_type and compress_level attributes and pass it to ZipFile.open().

Please open an issue for further discussion. If this change be accepted, the PR will need tests and updating documentation.

@AA-Turner AA-Turner removed the pending The issue will be closed if no feedback is provided label Apr 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review stdlib Standard Library Python modules in the Lib/ directory

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

6 participants

X Tutup