diff options
author | Georg Brandl <georg@python.org> | 2008-01-07 17:09:35 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2008-01-07 17:09:35 (GMT) |
commit | 2da0fceba7dd70334aacbab0708a8cbdff92e31d (patch) | |
tree | f93838b60f3c3216db03eaa24b32f4dc92389230 /Python/import.c | |
parent | b3255ed8c937510076b641db28ab052ddaee1178 (diff) | |
download | cpython-2da0fceba7dd70334aacbab0708a8cbdff92e31d.zip cpython-2da0fceba7dd70334aacbab0708a8cbdff92e31d.tar.gz cpython-2da0fceba7dd70334aacbab0708a8cbdff92e31d.tar.bz2 |
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
Diffstat (limited to 'Python/import.c')
-rw-r--r-- | Python/import.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c index e191bd5..8094f7d 100644 --- a/Python/import.c +++ b/Python/import.c @@ -950,8 +950,11 @@ load_source_module(char *name, char *pathname, FILE *fp) 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); |