https://github.com/python/cpython/commit/635d1b7b63d4bfa8bd764b0d9caa5ebf3fc079e5
commit: 635d1b7b63d4bfa8bd764b0d9caa5ebf3fc079e5
branch: 3.13
author: Miss Islington (bot) <[email protected]>
committer: serhiy-storchaka <[email protected]>
date: 2026-02-19T23:11:16Z
summary:

[3.13] Correct MAX_N in Lib/zipfile ZipExtFile (GH-144973) (GH-145023)

"<<" has lower precedence than "-".
(cherry picked from commit 4141f0a1ee6a6e9d5b4ba24f15a9d17df6933321)

Co-authored-by: J Berg <[email protected]>

files:
M Lib/test/test_compile.py
M Lib/test/test_unpack_ex.py
M Lib/zipfile/__init__.py

diff --git a/Lib/test/test_compile.py b/Lib/test/test_compile.py
index cdc8d8ef539f81..41737943f21fe1 100644
--- a/Lib/test/test_compile.py
+++ b/Lib/test/test_compile.py
@@ -245,8 +245,8 @@ def test_32_63_bit_values(self):
             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:
diff --git a/Lib/test/test_unpack_ex.py b/Lib/test/test_unpack_ex.py
index 9e2d54bd3a8c4e..c948d51452dbd9 100644
--- a/Lib/test/test_unpack_ex.py
+++ b/Lib/test/test_unpack_ex.py
@@ -383,13 +383,13 @@
 
 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):
      ...
diff --git a/Lib/zipfile/__init__.py b/Lib/zipfile/__init__.py
index c01f13729e1c99..3d889e9c4f16d3 100644
--- a/Lib/zipfile/__init__.py
+++ b/Lib/zipfile/__init__.py
@@ -884,7 +884,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

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3//lists/python-checkins.python.org
Member address: [email protected]

Reply via email to