]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Correct MAX_N in Lib/zipfile ZipExtFile (GH-144973)
authorJ Berg <j.berg2349@gmail.com>
Thu, 19 Feb 2026 22:48:01 +0000 (22:48 +0000)
committerGitHub <noreply@github.com>
Thu, 19 Feb 2026 22:48:01 +0000 (00:48 +0200)
"<<" has lower precedence than "-".

Lib/test/test_compile.py
Lib/test/test_unpack_ex.py
Lib/zipfile/__init__.py

index 591332cb5b9bcf4ea42a19a20f289a809e8b2bd5..302b2c21935efe1866a14ac203021fb1e7446c14 100644 (file)
@@ -249,8 +249,8 @@ class TestSpecifics(unittest.TestCase):
             d = -281474976710656  # 1 << 48
             e = +4611686018427387904  # 1 << 62
             f = -4611686018427387904  # 1 << 62
-            g = +9223372036854775807  # 1 << 63 - 1
-            h = -9223372036854775807  # 1 << 63 - 1
+            g = +9223372036854775807  # (1 << 63) - 1
+            h = -9223372036854775807  # (1 << 63) - 1
 
             for variable in self.test_32_63_bit_values.__code__.co_consts:
                 if variable is not None:
index d147cd96d207dbd43981a3da96dab675dea68cd0..904cf4f626ae78450428a683524128587d361094 100644 (file)
@@ -543,13 +543,13 @@ Now some general starred expressions (all fail).
 
 Some size constraints (all fail.)
 
-    >>> s = ", ".join("a%d" % i for i in range(1<<8)) + ", *rest = range(1<<8 + 1)"
+    >>> s = ", ".join("a%d" % i for i in range(1<<8)) + ", *rest = range((1<<8) + 1)"
     >>> compile(s, 'test', 'exec') # doctest:+ELLIPSIS
     Traceback (most recent call last):
      ...
     SyntaxError: too many expressions in star-unpacking assignment
 
-    >>> s = ", ".join("a%d" % i for i in range(1<<8 + 1)) + ", *rest = range(1<<8 + 2)"
+    >>> s = ", ".join("a%d" % i for i in range((1<<8) + 1)) + ", *rest = range((1<<8) + 2)"
     >>> compile(s, 'test', 'exec') # doctest:+ELLIPSIS
     Traceback (most recent call last):
      ...
index 8234bf52d39c5f9c72847b517018674182bd48eb..51e0ce9fa36d7ea9b946b9cbed24d3f34cfa9df8 100644 (file)
@@ -950,7 +950,7 @@ class ZipExtFile(io.BufferedIOBase):
     """
 
     # Max size supported by decompressor.
-    MAX_N = 1 << 31 - 1
+    MAX_N = (1 << 31) - 1
 
     # Read from compressed files in 4k blocks.
     MIN_READ_SIZE = 4096