Skip to content

Commit 9fb8493

Browse files
author
jhylton
committed
Better error message
git-svn-id: http://svn.python.org/projects/python/trunk@33242 6015fed2-1504-0410-9fe1-9d1591cc4771
1 parent f6772b3 commit 9fb8493

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

Python/modsupport.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,11 +514,17 @@ int
514514
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
515515
{
516516
PyObject *dict;
517-
if (!PyModule_Check(m) || o == NULL) {
517+
if (!PyModule_Check(m)) {
518518
PyErr_SetString(PyExc_TypeError,
519519
"PyModule_AddObject() needs module as first arg");
520520
return -1;
521521
}
522+
if (!o) {
523+
PyErr_SetString(PyExc_TypeError,
524+
"PyModule_AddObject() needs non-NULL value");
525+
return -1;
526+
}
527+
522528
dict = PyModule_GetDict(m);
523529
if (dict == NULL) {
524530
/* Internal error -- modules must have a dict! */

0 commit comments

Comments
 (0)