Skip to content

Commit 4141f0a

Browse files
authored
Correct MAX_N in Lib/zipfile ZipExtFile (GH-144973)
"<<" has lower precedence than "-".
1 parent beb8e3f commit 4141f0a

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
@@ -543,13 +543,13 @@
543543
544544
Some size constraints (all fail.)
545545
546-
>>> s = ", ".join("a%d" % i for i in range(1<<8)) + ", *rest = range(1<<8 + 1)"
546+
>>> s = ", ".join("a%d" % i for i in range(1<<8)) + ", *rest = range((1<<8) + 1)"
547547
>>> compile(s, 'test', 'exec') # doctest:+ELLIPSIS
548548
Traceback (most recent call last):
549549
...
550550
SyntaxError: too many expressions in star-unpacking assignment
551551
552-
>>> s = ", ".join("a%d" % i for i in range(1<<8 + 1)) + ", *rest = range(1<<8 + 2)"
552+
>>> s = ", ".join("a%d" % i for i in range((1<<8) + 1)) + ", *rest = range((1<<8) + 2)"
553553
>>> compile(s, 'test', 'exec') # doctest:+ELLIPSIS
554554
Traceback (most recent call last):
555555
...

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)