Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c190389

Browse files
committed
Issue #17220: two fixes for changeset 2528e4aea338.
First, because the mtime can exceed 4 bytes, make sure to mask it down to 4 bytes before getting its little-endian representation for writing out to a .pyc file. Two, cap an rsplit() call to 1 split, else can lead to too many values being returned for unpacking.
1 parent 91d0ca7 commit c190389

2 files changed

Lines changed: 4194 additions & 4192 deletions

File tree

Lib/importlib/_bootstrap.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def _w_long(x):
4848
XXX Temporary until marshal's long functions are exposed.
4949
5050
"""
51-
return int(x).to_bytes(4, 'little')
51+
return (int(x) & 0xFFFFFFFF).to_bytes(4, 'little')
5252

5353

5454
# TODO: Expose from marshal
@@ -74,7 +74,7 @@ def _path_split(path):
7474
return front, tail
7575
for x in reversed(path):
7676
if x in path_separators:
77-
front, tail = path.rsplit(x)
77+
front, tail = path.rsplit(x, maxsplit=1)
7878
return front, tail
7979
return '', path
8080

0 commit comments

Comments
 (0)