[Python-checkins] cpython (2.7): Make guard more dynamic (apparently the size of a filesystem timestamp may vary

antoine.pitrou python-checkins at python.org
Wed Jan 25 03:41:52 CET 2012


http://hg.python.org/cpython/rev/0bec943f6778
changeset:   74605:0bec943f6778
branch:      2.7
parent:      74601:dd1b4fc2d736
user:        Antoine Pitrou <solipsis at pitrou.net>
date:        Wed Jan 25 03:31:39 2012 +0100
summary:
  Make guard more dynamic (apparently the size of a filesystem timestamp may vary under Windows).

files:
  Python/import.c |  16 ++++++++--------
  1 files changed, 8 insertions(+), 8 deletions(-)


diff --git a/Python/import.c b/Python/import.c
--- a/Python/import.c
+++ b/Python/import.c
@@ -979,14 +979,14 @@
                      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 &&

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list