From: Antoine Pitrou Date: Wed, 25 Jan 2012 02:31:39 +0000 (+0100) Subject: Make guard more dynamic (apparently the size of a filesystem timestamp may vary under... X-Git-Tag: v2.7.3rc1~129 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=0e5fd59a27925ee5387717f3ed1f8ca2f3d64cbc;p=python Make guard more dynamic (apparently the size of a filesystem timestamp may vary under Windows). --- diff --git a/Python/import.c b/Python/import.c index 0e823909b2..9876aad400 100644 --- a/Python/import.c +++ b/Python/import.c @@ -979,14 +979,14 @@ load_source_module(char *name, char *pathname, FILE *fp) pathname); return NULL; } -#if SIZEOF_TIME_T > 4 - /* Python's .pyc timestamp handling presumes that the timestamp fits - 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). - */ - st.st_mtime &= 0xFFFFFFFF; -#endif + if (sizeof st.st_mtime > 4) { + /* Python's .pyc timestamp handling presumes that the timestamp fits + 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). + */ + st.st_mtime &= 0xFFFFFFFF; + } cpathname = make_compiled_pathname(pathname, buf, (size_t)MAXPATHLEN + 1); if (cpathname != NULL &&