Mercurial > cpython-lru_cache-weakref
diff Python/modsupport.c @ 29579:60ce73ea9c92 legacy-trunk
Better error message
| author | Jeremy Hylton <jeremy@alum.mit.edu> |
|---|---|
| date | Sat, 21 Jun 2003 21:35:25 +0000 |
| parents | 8836529e9e66 |
| children | a6879d1733d7 |
line wrap: on
line diff
--- a/Python/modsupport.c Sat Jun 21 14:49:14 2003 +0000 +++ b/Python/modsupport.c Sat Jun 21 21:35:25 2003 +0000 @@ -514,11 +514,17 @@ 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! */
