]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
[3.14] Correct MAX_N in Lib/zipfile ZipExtFile (GH-144973) (GH-145022)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Thu, 19 Feb 2026 23:13:43 +0000 (00:13 +0100)
committerGitHub <noreply@github.com>
Thu, 19 Feb 2026 23:13:43 +0000 (23:13 +0000)
"<<" has lower precedence than "-".
(cherry picked from commit 4141f0a1ee6a6e9d5b4ba24f15a9d17df6933321)

Co-authored-by: J Berg <j.berg2349@gmail.com>
Lib/test/test_compile.py
Lib/test/test_unpack_ex.py
Lib/zipfile/__init__.py

index d37a9db8c8368ab39fa736ef084ef3847ce40152..a6542b396ccfcfa287ca10e874d09f2a6e33851b 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 9e2d54bd3a8c4eacb218cbe64f8d90278b0b5822..c948d51452dbd92a97fabb3d6fd398fda69a1731 100644 (file)
@@ -383,13 +383,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 ac2332e58468a2edb73542606cfc725ed0756c03..19aea290b585312f566916dbcad7c6685f108524 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