Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit c44dbc4

Browse files
committed
Better error message
1 parent ac8657b commit c44dbc4

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)