summaryrefslogtreecommitdiffstats
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, 6 insertions, 1 deletions
diff --git a/Python/import.c b/Python/import.c
index ef37e8b..a05078e 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -934,7 +934,8 @@ load_source_module(char *name, char *pathname, FILE *fp)
if (Py_VerboseFlag)
PySys_WriteStderr("import %s # from %s\n",
name, pathname);
- write_compiled_module(co, cpathname, mtime);
+ if (cpathname)
+ write_compiled_module(co, cpathname, mtime);
}
m = PyImport_ExecCodeModuleEx(name, (PyObject *)co, pathname);
Py_DECREF(co);
@@ -1233,6 +1234,8 @@ find_module(char *fullname, char *subname, PyObject *path, char *buf,
for (i = 0; i < npath; i++) {
PyObject *copy = NULL;
PyObject *v = PyList_GetItem(path, i);
+ if (!v)
+ return NULL;
#ifdef Py_USING_UNICODE
if (PyUnicode_Check(v)) {
copy = PyUnicode_Encode(PyUnicode_AS_UNICODE(v),
@@ -3045,6 +3048,8 @@ initimp(void)
if (m == NULL)
goto failure;
d = PyModule_GetDict(m);
+ if (d == NULL)
+ goto failure;
if (setint(d, "SEARCH_ERROR", SEARCH_ERROR) < 0) goto failure;
if (setint(d, "PY_SOURCE", PY_SOURCE) < 0) goto failure;