summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
Diffstat (limited to 'Python')
-rw-r--r--Python/modsupport.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c
index b4640b0..ec85511 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -520,8 +520,9 @@ PyModule_AddObject(PyObject *m, char *name, PyObject *o)
return -1;
}
if (!o) {
- PyErr_SetString(PyExc_TypeError,
- "PyModule_AddObject() needs non-NULL value");
+ if (!PyErr_Occurred())
+ PyErr_SetString(PyExc_TypeError,
+ "PyModule_AddObject() needs non-NULL value");
return -1;
}