@@ -30,10 +30,22 @@ extern time_t PyOS_GetLastModificationTime(char *, FILE *);
3030/* Change for each incompatible change */
3131/* The value of CR and LF is incorporated so if you ever read or write
3232 a .pyc file in text mode the magic number will be wrong; also, the
33- Apple MPW compiler swaps their values, botching string constants */
33+ Apple MPW compiler swaps their values, botching string constants.
34+ XXX That probably isn't important anymore.
35+ */
3436/* XXX Perhaps the magic number should be frozen and a version field
3537 added to the .pyc file header? */
36- /* New way to come up with the magic number: (YEAR-1995), MONTH, DAY */
38+ /* New way to come up with the low 16 bits of the magic number:
39+ (YEAR-1995) * 10000 + MONTH * 100 + DAY
40+ where MONTH and DAY are 1-based.
41+ XXX Whatever the "old way" may have been isn't documented.
42+ XXX This scheme breaks in 2002, as (2002-1995)*10000 = 70000 doesn't
43+ fit in 16 bits.
44+ XXX Later, sometimes 1 gets added to MAGIC in order to record that
45+ the Unicode -U option is in use. IMO (Tim's), that's a Bad Idea
46+ (quite apart from that the -U option doesn't work so isn't used
47+ anyway).
48+ */
3749#define MAGIC (60717 | ((long)'\r'<<16) | ((long)'\n'<<24))
3850
3951/* Magic word as global; note that _PyImport_Init() can change the
@@ -63,7 +75,7 @@ static const struct filedescr _PyImport_StandardFiletab[] = {
6375 {".py" , "r" , PY_SOURCE },
6476#ifdef MS_WIN32
6577 {".pyw" , "r" , PY_SOURCE },
66- #endif
78+ #endif
6779 {".pyc" , "rb" , PY_COMPILED },
6880 {0 , 0 }
6981};
@@ -739,7 +751,7 @@ load_source_module(char *name, char *pathname, FILE *fp)
739751 return NULL ;
740752 }
741753#endif
742- cpathname = make_compiled_pathname (pathname , buf ,
754+ cpathname = make_compiled_pathname (pathname , buf ,
743755 (size_t )MAXPATHLEN + 1 );
744756 if (cpathname != NULL &&
745757 (fpc = check_compiled_module (pathname , mtime , cpathname ))) {
0 commit comments