Skip to content

Commit 033e0f7

Browse files
[3.14] Correct MAX_N in Lib/zipfile ZipExtFile (GH-144973) (GH-145022)
"<<" has lower precedence than "-". (cherry picked from commit 4141f0a) Co-authored-by: J Berg <j.berg2349@gmail.com>
1 parent 1404a4d commit 033e0f7

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Lib/test/test_compile.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -249,8 +249,8 @@ def test_32_63_bit_values(self):
249249
d = -281474976710656 # 1 << 48
250250
e = +4611686018427387904 # 1 << 62
251251
f = -4611686018427387904 # 1 << 62
252-
g = +9223372036854775807 # 1 << 63 - 1
253-
h = -9223372036854775807 # 1 << 63 - 1
252+
g = +9223372036854775807 # (1 << 63) - 1
253+
h = -9223372036854775807 # (1 << 63) - 1
254254

255255
for variable in self.test_32_63_bit_values.__code__.co_consts:
256256
if variable is not None:

Lib/test/test_unpack_ex.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -383,13 +383,13 @@
383383
384384
Some size constraints (all fail.)
385385
386-
>>> s = ", ".join("a%d" % i for i in range(1<<8)) + ", *rest = range(1<<8 + 1)"
386+
>>> s = ", ".join("a%d" % i for i in range(1<<8)) + ", *rest = range((1<<8) + 1)"
387387
>>> compile(s, 'test', 'exec') # doctest:+ELLIPSIS
388388
Traceback (most recent call last):
389389
...
390390
SyntaxError: too many expressions in star-unpacking assignment
391391
392-
>>> s = ", ".join("a%d" % i for i in range(1<<8 + 1)) + ", *rest = range(1<<8 + 2)"
392+
>>> s = ", ".join("a%d" % i for i in range((1<<8) + 1)) + ", *rest = range((1<<8) + 2)"
393393
>>> compile(s, 'test', 'exec') # doctest:+ELLIPSIS
394394
Traceback (most recent call last):
395395
...

Lib/zipfile/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -950,7 +950,7 @@ class ZipExtFile(io.BufferedIOBase):
950950
"""
951951

952952
# Max size supported by decompressor.
953-
MAX_N = 1 << 31 - 1
953+
MAX_N = (1 << 31) - 1
954954

955955
# Read from compressed files in 4k blocks.
956956
MIN_READ_SIZE = 4096

0 commit comments

Comments
 (0)