summaryrefslogtreecommitdiff
path: root/Python/import.c
diff options
context:
space:
mode:
Diffstat (limited to 'Python/import.c')
-rw-r--r--Python/import.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/Python/import.c b/Python/import.c
index e191bd576a..8094f7d477 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);