summaryrefslogtreecommitdiffstats
path: root/Lib/importlib
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2013-02-25 22:10:11 (GMT)
committerBrett Cannon <brett@python.org>2013-02-25 22:10:11 (GMT)
commitc19038983425fee91958d51b3eefcb56dfc9f0f1 (patch)
tree6453681d94393f19b71bf6bedadf67e9ceec6f1d /Lib/importlib
parent91d0ca72de9ef3e49adba508e0752b084f1b5a06 (diff)
downloadcpython-c19038983425fee91958d51b3eefcb56dfc9f0f1.zip
cpython-c19038983425fee91958d51b3eefcb56dfc9f0f1.tar.gz
cpython-c19038983425fee91958d51b3eefcb56dfc9f0f1.tar.bz2
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.
Diffstat (limited to 'Lib/importlib')
-rw-r--r--Lib/importlib/_bootstrap.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/importlib/_bootstrap.py b/Lib/importlib/_bootstrap.py
index 89d43b3..c471b2f 100644
--- a/Lib/importlib/_bootstrap.py
+++ b/Lib/importlib/_bootstrap.py
@@ -48,7 +48,7 @@ def _w_long(x):
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
@@ -74,7 +74,7 @@ def _path_split(path):
return front, tail
for x in reversed(path):
if x in path_separators:
- front, tail = path.rsplit(x)
+ front, tail = path.rsplit(x, maxsplit=1)
return front, tail
return '', path