Skip to content

gh-161086: Honor --fast and --best for file arguments in gzip CLI - #161087

Merged
gpshead merged 1 commit into
python:mainfrom
gpshead:gzip-cli-compresslevel-files
Nov 1, 2026
Merged

gpshead merged 1 commit into
python:mainfrom
gpshead:gzip-cli-compresslevel-files

Conversation

@gpshead

@gpshead gpshead commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Pass the compression level selected by --fast/--best to gzip.open() when compressing file arguments, as the stdin path already does. The existing CLI test now checks the XFL header byte, which GzipFile sets from the level it was given.

Fixes #161086

The file branch of gzip.main() did not pass the compression level to
gzip.open(), so only stdin input was affected by --fast/--best.
@gpshead gpshead added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 1, 2026
@gpshead gpshead self-assigned this Nov 1, 2026
@gpshead
gpshead marked this pull request as ready for review November 1, 2026 17:35
@gpshead
gpshead enabled auto-merge (squash) November 1, 2026 17:36
@gpshead
gpshead merged commit 8a316ff into python:main Nov 1, 2026
59 checks passed
@miss-islington-app

Copy link
Copy Markdown

Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14, 3.15.
🐍🍒⛏🤖

@gpshead gpshead added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes and removed needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 1, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @gpshead for the PR 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@gpshead
gpshead deleted the gzip-cli-compresslevel-files branch November 1, 2026 18:33
@bedevere-app

bedevere-app Bot commented Nov 1, 2026

Copy link
Copy Markdown

GH-161118 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 1, 2026
@bedevere-app

bedevere-app Bot commented Nov 1, 2026

Copy link
Copy Markdown

GH-161119 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 1, 2026
gpshead added a commit that referenced this pull request Nov 1, 2026
…CLI (GH-161087) (#161119)

The file branch of gzip.main() did not pass the compression level to
gzip.open(), so only stdin input was affected by --fast/--best.

(cherry picked from commit 8a316ff)
gpshead added a commit that referenced this pull request Nov 1, 2026
…CLI (GH-161087) (#161118)

The file branch of gzip.main() did not pass the compression level to
gzip.open(), so only stdin input was affected by --fast/--best.

(cherry picked from commit 8a316ff)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

python -m gzip ignores --fast and --best for file arguments

1 participant