Skip to content

[heads up] The default compression level of gzip.GZipFile object is changed to 6 in Python 3.15 #1477

Description

@befeleme

In Python 3.15, the default compression level is reduced to 6.

Changed in version 3.15: The default compression level was reduced to 6 (down from 9). It is the default level used by most compression tools and a better tradeoff between speed and performance.

DeterministicGzipFile inherits from that class, and sets the compression level to 9 (two places with the default).

compresslevel: int = 9,

The tests for this object started failing on the nonmatching checksums with Python 3.15.0a6 in Fedora Linux, where I test the readiness of packages to support new Python versions.

This can either be mitigated by matching the compression level to Python's if the class is supposed to closely follow upstream, or increase the compression level of the gzip's GZipFile instance in the test:

with GzipFile(filename='', mode='wb', fileobj=fobj, mtime=0) as gzobj:

I tested the first approach locally on my machine, and the tests passed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions