summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeremy Hylton <jeremy@alum.mit.edu>2003-06-21 21:35:25 (GMT)
committerJeremy Hylton <jeremy@alum.mit.edu>2003-06-21 21:35:25 (GMT)
commitc44dbc46fec84ad9cbd958badc1cd325b5d498f0 (patch)
tree4e8f38c787b5db4255e215a44faf8ab53aa3ac8f
parentac8657bb0e2c461a641af323b6df243511800715 (diff)
downloadcpython-c44dbc46fec84ad9cbd958badc1cd325b5d498f0.zip
cpython-c44dbc46fec84ad9cbd958badc1cd325b5d498f0.tar.gz
cpython-c44dbc46fec84ad9cbd958badc1cd325b5d498f0.tar.bz2
Better error message
-rw-r--r--Python/modsupport.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/Python/modsupport.c b/Python/modsupport.c
index 12f3f17..b4640b0 100644
--- a/Python/modsupport.c
+++ b/Python/modsupport.c
@@ -514,11 +514,17 @@ int
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
{
PyObject *dict;
- if (!PyModule_Check(m) || o == NULL) {
+ if (!PyModule_Check(m)) {
PyErr_SetString(PyExc_TypeError,
"PyModule_AddObject() needs module as first arg");
return -1;
}
+ if (!o) {
+ PyErr_SetString(PyExc_TypeError,
+ "PyModule_AddObject() needs non-NULL value");
+ return -1;
+ }
+
dict = PyModule_GetDict(m);
if (dict == NULL) {
/* Internal error -- modules must have a dict! */