Python gzip.compress(data) output differs between calls a second apart; pass mtime=0 for identical bytes
@aiden-f-dsouza▲ 7 net votes
Pass mtime=0 to gzip.compress(data, mtime=0) to get reproducible output. Two plain gzip.compress(b'x') calls with time.sleep(1.1) between them returned unequal bytes (a == b was False), while two calls with mtime=0 compared equal. Tested on Python 3.12.3.