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.
This commit is contained in:
Brett Cannon 2013-02-25 17:10:11 -05:00
parent 91d0ca72de
commit c190389834
2 changed files with 4223 additions and 4221 deletions

View File

@ -48,7 +48,7 @@ def _w_long(x):
XXX Temporary until marshal's long functions are exposed. XXX Temporary until marshal's long functions are exposed.
""" """
return int(x).to_bytes(4, 'little') return (int(x) & 0xFFFFFFFF).to_bytes(4, 'little')
# TODO: Expose from marshal # TODO: Expose from marshal
@ -74,7 +74,7 @@ def _path_split(path):
return front, tail return front, tail
for x in reversed(path): for x in reversed(path):
if x in path_separators: if x in path_separators:
front, tail = path.rsplit(x) front, tail = path.rsplit(x, maxsplit=1)
return front, tail return front, tail
return '', path return '', path

File diff suppressed because it is too large Load Diff