@@ -1226,9 +1226,9 @@ write_compiled_module(PyCodeObject *co, char *cpathname, struct stat *srcstat)
12261226 (void ) unlink (cpathname );
12271227 return ;
12281228 }
1229- /* Now write the true mtime */
1229+ /* Now write the true mtime (as a 32-bit field) */
12301230 fseek (fp , 4L , 0 );
1231- assert (mtime < LONG_MAX );
1231+ assert (mtime <= 0xFFFFFFFF );
12321232 PyMarshal_WriteLongToFile ((long )mtime , fp , Py_MARSHAL_VERSION );
12331233 fflush (fp );
12341234 fclose (fp );
@@ -1302,14 +1302,14 @@ load_source_module(char *name, char *pathname, FILE *fp)
13021302 pathname );
13031303 return NULL ;
13041304 }
1305- # if SIZEOF_TIME_T > 4
1306- /* Python's .pyc timestamp handling presumes that the timestamp fits
1307- in 4 bytes. Since the code only does an equality comparison,
1308- ordering is not important and we can safely ignore the higher bits
1309- (collisions are extremely unlikely).
1310- */
1311- st .st_mtime &= 0xFFFFFFFF ;
1312- #endif
1305+ if ( sizeof st . st_mtime > 4 ) {
1306+ /* Python's .pyc timestamp handling presumes that the timestamp fits
1307+ in 4 bytes. Since the code only does an equality comparison,
1308+ ordering is not important and we can safely ignore the higher bits
1309+ (collisions are extremely unlikely).
1310+ */
1311+ st .st_mtime &= 0xFFFFFFFF ;
1312+ }
13131313 cpathname = make_compiled_pathname (
13141314 pathname , buf , (size_t )MAXPATHLEN + 1 , !Py_OptimizeFlag );
13151315 if (cpathname != NULL &&
0 commit comments