Mercurial > cpython-lru_cache-weakref
diff Python/import.c @ 44566:599f22a349a2 legacy-trunk
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
| author | Georg Brandl <georg@python.org> |
|---|---|
| date | Mon, 07 Jan 2008 17:09:35 +0000 |
| parents | 0cbe94bea2c7 |
| children | 132d908471c8 |
line wrap: on
line diff
--- a/Python/import.c Mon Jan 07 16:43:47 2008 +0000 +++ b/Python/import.c Mon Jan 07 17:09:35 2008 +0000 @@ -950,8 +950,11 @@ if (Py_VerboseFlag) PySys_WriteStderr("import %s # from %s\n", name, pathname); - if (cpathname) - write_compiled_module(co, cpathname, mtime); + if (cpathname) { + PyObject *ro = PySys_GetObject("dont_write_bytecode"); + if (ro == NULL || !PyObject_IsTrue(ro)) + write_compiled_module(co, cpathname, mtime); + } } m = PyImport_ExecCodeModuleEx(name, (PyObject *)co, pathname); Py_DECREF(co);
