Kaydet (Commit) c1903898 authored tarafından Brett Cannon's avatar Brett Cannon

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.
üst 91d0ca72
...@@ -48,7 +48,7 @@ def _w_long(x): ...@@ -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): ...@@ -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
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment