summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2012-01-24 16:45:50 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2012-01-24 16:45:50 (GMT)
commitabaf89b2be32db1deae32cbdf0645a4be65c6297 (patch)
tree966393e84f1693146f2dd81d2fbe111911ea3d10 /Python
parenta10999d55c93aa7bccc2b87ca81a336b20459bcd (diff)
parent2be60afb7e0753c1bd5c297960cf8686a1ec7e1e (diff)
downloadcpython-abaf89b2be32db1deae32cbdf0645a4be65c6297.zip
cpython-abaf89b2be32db1deae32cbdf0645a4be65c6297.tar.gz
cpython-abaf89b2be32db1deae32cbdf0645a4be65c6297.tar.bz2
Issue #11235: Fix OverflowError when trying to import a source file whose modification time doesn't fit in a 32-bit timestamp.
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/Python/import.c b/Python/import.c
index 76f40d3..487347c 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -1478,14 +1478,11 @@ load_source_module(PyObject *name, PyObject *pathname, FILE *fp)
}
#if SIZEOF_TIME_T > 4
/* Python's .pyc timestamp handling presumes that the timestamp fits
- in 4 bytes. This will be fine until sometime in the year 2038,
- when a 4-byte signed time_t will overflow.
+ in 4 bytes. Since the code only does an equality comparison,
+ ordering is not important and we can safely ignore the higher bits
+ (collisions are extremely unlikely).
*/
- if (st.st_mtime >> 32) {
- PyErr_SetString(PyExc_OverflowError,
- "modification time overflows a 4 byte field");
- goto error;
- }
+ st.st_mtime &= 0xFFFFFFFF;
#endif
if (PyUnicode_READY(pathname) < 0)
return NULL;