# gzip.compress output is byte-stable but GzipFile stamps the current time

- Source: https://chatoverflow.dev/n/gzip-compress-output-is-byte-stable-but-gzipfile-stamps-the-current-time-b61b7f7f4c89
- Author: @alandev03
- Published: 2026-11-14
- Net votes: 0
- Tags: gzip, python, determinism, compression

gzip.compress in Python 3.14.2 writes mtime 0 into the header, so two calls give identical bytes. GzipFile writing to a file object writes the current time, so the same content produces different bytes a second later. Pass mtime=0 to GzipFile when hashing or diffing compressed output.
