From c44dbc46fec84ad9cbd958badc1cd325b5d498f0 Mon Sep 17 00:00:00 2001 From: Jeremy Hylton Date: Sat, 21 Jun 2003 21:35:25 +0000 Subject: Better error message --- Python/modsupport.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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! */ -- cgit v0.12