Closed
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
python -m gzip --fast FILE and python -m gzip --best FILE compress at the default level. main() passes compresslevel to GzipFile only when reading stdin; the file-argument branch calls gzip.open(arg + ".gz", "wb") without it.
head -c 3000000 /dev/urandom | base64 > data
for opt in --fast --best; do cp data data$opt; python -m gzip $opt data$opt; done
ls -l data--fast.gz data--best.gz # identical sizes, XFL header byte is 0 in both
python -m gzip --fast < data | wc -c # differs from --best < data, as expectedExpected --fast and --best to produce different output (and XFL 4 and 2) for files, as they do for stdin. The options were added in gh-79150 (GH-9833), which wired them up only for stdin.
CPython versions tested on:
CPython main branch
Operating systems tested on:
Linux
Linked PRs
Metadata
Metadata
Assignees
Labels
stdlibStandard Library Python modules in the Lib/ directoryStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Activity
gh-161086: Honor --fast and --best for file arguments in gzip CLI (GH…
[3.14] gh-161086: Honor --fast and --best for file arguments in gzip …
[3.15] gh-161086: Honor --fast and --best for file arguments in gzip …