]> granicus.if.org Git - python/commitdiff
Better error message
authorJeremy Hylton <jeremy@alum.mit.edu>
Sat, 21 Jun 2003 21:35:25 +0000 (21:35 +0000)
committerJeremy Hylton <jeremy@alum.mit.edu>
Sat, 21 Jun 2003 21:35:25 +0000 (21:35 +0000)
Python/modsupport.c

index 12f3f17b487011561c13568f2aaa3e23eda89ca7..b4640b064a3f416544e383a668f94312ebcb3841 100644 (file)
@@ -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! */