gh-112346: Bugfix: Remove faster codepath from gzip.compress as it introduces behavioral inconsistencies by rhpvorderman · Pull Request #114116 · python/cpython

I would suggest the following fixup to make this work on BE (mtime is always LE, regardless of the host endianness):

--- a/Lib/test/test_gzip.py
+++ b/Lib/test/test_gzip.py
@@ -725,7 +725,7 @@ def test_issue112346(self):
         for mtime in (0, 42):
             with self.subTest(mtime=mtime):
                 compress = gzip.compress(data1, compresslevel=1, mtime=mtime)
-                assert struct.unpack("IxB", compress[4:10]) == (mtime, 255)
+                assert struct.unpack("<IxB", compress[4:10]) == (mtime, 255)
 
     def test_decompress(self):
         for data in (data1, data2):