mirror of
https://github.com/python/cpython.git
synced 2025-09-11 11:17:16 +00:00
Patch #602345 by Neal Norwitz and me: add -B option and PYTHONDONTWRITEBYTECODE envvar to skip writing bytecode.
This commit is contained in:
parent
b3255ed8c9
commit
2da0fceba7
8 changed files with 56 additions and 8 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue