summaryrefslogtreecommitdiff
path: root/Python
diff options
context:
space:
mode:
authorAndrew M. Kuchling <amk@amk.ca>2006-09-27 19:17:32 +0000
committerAndrew M. Kuchling <amk@amk.ca>2006-09-27 19:17:32 +0000
commite7031223e36c43ccd47321b3ff8997c1423e2b9c (patch)
treea8822cdeb18e24a91bd5e3e129db1cfa95d05b78 /Python
parent4c16bac18c82868e3f20a2c4ca8f329605942ff8 (diff)
downloadcpython-git-e7031223e36c43ccd47321b3ff8997c1423e2b9c.tar.gz
[Backport of rev. 42093 by neal.norwitz]
Check return result from Py_InitModule*(). This API can fail. Probably should be backported.
Diffstat (limited to 'Python')
-rw-r--r--Python/import.c2
-rw-r--r--Python/marshal.c2
-rw-r--r--Python/sysmodule.c2
3 files changed, 6 insertions, 0 deletions
diff --git a/Python/import.c b/Python/import.c
index ee7c59300e..5033819d8c 100644
--- a/Python/import.c
+++ b/Python/import.c
@@ -2822,6 +2822,8 @@ initimp(void)
m = Py_InitModule4("imp", imp_methods, doc_imp,
NULL, PYTHON_API_VERSION);
+ if (m == NULL)
+ goto failure;
d = PyModule_GetDict(m);
if (setint(d, "SEARCH_ERROR", SEARCH_ERROR) < 0) goto failure;
diff --git a/Python/marshal.c b/Python/marshal.c
index 0ab0597d32..df88bcb2c7 100644
--- a/Python/marshal.c
+++ b/Python/marshal.c
@@ -928,5 +928,7 @@ PyMODINIT_FUNC
PyMarshal_Init(void)
{
PyObject *mod = Py_InitModule("marshal", marshal_methods);
+ if (mod == NULL)
+ return;
PyModule_AddIntConstant(mod, "version", Py_MARSHAL_VERSION);
}
diff --git a/Python/sysmodule.c b/Python/sysmodule.c
index b51fa86a76..d48194b3b8 100644
--- a/Python/sysmodule.c
+++ b/Python/sysmodule.c
@@ -944,6 +944,8 @@ _PySys_Init(void)
#endif
m = Py_InitModule3("sys", sys_methods, sys_doc);
+ if (m == NULL)
+ return NULL;
sysdict = PyModule_GetDict(m);
{