Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 5180:6bc56259cc4c legacy-trunk
When -O is given, use ".pyo" instead of ".pyc".
| author | Guido van Rossum <guido@python.org> |
|---|---|
| date | Tue, 11 Mar 1997 18:37:35 +0000 |
| parents | 104a646fc7a6 |
| children | c72c7e1930b3 |
line wrap: on
line diff
--- a/Python/import.c Tue Mar 11 18:24:21 1997 +0000 +++ b/Python/import.c Tue Mar 11 18:37:35 1997 +0000 @@ -81,6 +81,14 @@ fatal("duplicate initimport() call"); if ((import_modules = newdictobject()) == NULL) fatal("no mem for dictionary of modules"); + if (Py_OptimizeFlag) { + /* Replace ".pyc" with ".pyo" in import_filetab */ + struct filedescr *p; + for (p = import_filetab; p->suffix != NULL; p++) { + if (strcmp(p->suffix, ".pyc") == 0) + p->suffix = ".pyo"; + } + } } @@ -202,7 +210,7 @@ if (len+2 > buflen) return NULL; strcpy(buf, pathname); - strcpy(buf+len, "c"); + strcpy(buf+len, Py_OptimizeFlag ? "o" : "c"); return buf; }
