Improve CHANGELOG and code comment

This commit is contained in:
Bruno Oliveira 2019-03-13 18:52:30 -03:00
parent 489c61a22d
commit 44cb51010c
2 changed files with 3 additions and 1 deletions

View File

@ -1 +1 @@
Fix handling of mtime to work after year 2038
Use the correct modified time for years after 2038 in rewritten ``.pyc`` files.

View File

@ -344,8 +344,10 @@ def _write_pyc(state, co, source_stat, pyc):
try:
with atomicwrites.atomic_write(pyc, mode="wb", overwrite=True) as fp:
fp.write(imp.get_magic())
# as of now, bytecode header expects 32-bit numbers for size and mtime (#4903)
mtime = int(source_stat.mtime) & 0xFFFFFFFF
size = source_stat.size & 0xFFFFFFFF
# "<LL" stands for 2 unsigned longs, little-ending
fp.write(struct.pack("<LL", mtime, size))
fp.write(marshal.dumps(co))
except EnvironmentError as e: