]> granicus.if.org Git - python/commitdiff
Remove debug output, fix assert (hopefully) and exercise signedness issues a bit...
authorAntoine Pitrou <solipsis@pitrou.net>
Wed, 25 Jan 2012 14:38:32 +0000 (15:38 +0100)
committerAntoine Pitrou <solipsis@pitrou.net>
Wed, 25 Jan 2012 14:38:32 +0000 (15:38 +0100)
Lib/test/test_import.py
Python/import.c

index 412e6b81039a75f4098b2672f7bd7470bfae17d8..e426290df3a76e8e51ce67a2319469dd574a69e2 100644 (file)
@@ -288,7 +288,7 @@ class ImportTests(unittest.TestCase):
             with open(source, 'w') as f:
                 pass
             try:
-                os.utime(source, (2 ** 33, 2 ** 33))
+                os.utime(source, (2 ** 33 - 5, 2 ** 33 - 5))
             except OverflowError:
                 self.skipTest("cannot set modification time to large integer")
             except OSError as e:
index f9f3cdbbfbd0ac1cbf3aba539838a639ad155690..2cac9b530bb27259cc4a524afa017b10fda85873 100644 (file)
@@ -905,14 +905,9 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
         (void) unlink(cpathname);
         return;
     }
-    /* Now write the true mtime */
+    /* Now write the true mtime (as a 32-bit field) */
     fseek(fp, 4L, 0);
-    if (mtime >= LONG_MAX) {
-        fprintf(stderr, "** sizes=(%ld, %ld), mtime=%I64d >= %ld\n", sizeof(time_t), sizeof(srcstat->st_mtime), mtime, LONG_MAX);
-        assert(0);
-        /* can't get here */
-    }
-    assert(mtime < LONG_MAX);
+    assert(mtime <= 0xFFFFFFFF);
     PyMarshal_WriteLongToFile((long)mtime, fp, Py_MARSHAL_VERSION);
     fflush(fp);
     fclose(fp);