diff --git a/changelog/4903.bugfix.rst b/changelog/4903.bugfix.rst new file mode 100644 index 000000000..1e80fecbf --- /dev/null +++ b/changelog/4903.bugfix.rst @@ -0,0 +1 @@ +Fix handling of mtime to work after year 2038 diff --git a/src/_pytest/assertion/rewrite.py b/src/_pytest/assertion/rewrite.py index 301bdedc5..3b53fd395 100644 --- a/src/_pytest/assertion/rewrite.py +++ b/src/_pytest/assertion/rewrite.py @@ -344,9 +344,9 @@ 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()) - mtime = int(source_stat.mtime) + mtime = int(source_stat.mtime) & 0xFFFFFFFF size = source_stat.size & 0xFFFFFFFF - fp.write(struct.pack("