We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent ac8657b commit c44dbc4Copy full SHA for c44dbc4
1 file changed
Python/modsupport.c
@@ -514,11 +514,17 @@ int
514
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
515
{
516
PyObject *dict;
517
- if (!PyModule_Check(m) || o == NULL) {
+ if (!PyModule_Check(m)) {
518
PyErr_SetString(PyExc_TypeError,
519
"PyModule_AddObject() needs module as first arg");
520
return -1;
521
}
522
+ if (!o) {
523
+ PyErr_SetString(PyExc_TypeError,
524
+ "PyModule_AddObject() needs non-NULL value");
525
+ return -1;
526
+ }
527
+
528
dict = PyModule_GetDict(m);
529
if (dict == NULL) {
530
/* Internal error -- modules must have a dict! */
0 commit comments