Kaydet (Commit) 8311518a authored tarafından Fred Drake's avatar Fred Drake

PyModule_AddObject(): Added missing exceptions.

Closes SF bug #523473.
üst b084017c
......@@ -488,15 +488,22 @@ int
PyModule_AddObject(PyObject *m, char *name, PyObject *o)
{
PyObject *dict;
if (!PyModule_Check(m) || o == NULL)
return -1;
if (!PyModule_Check(m) || o == NULL) {
PyErr_SetString(PyExc_TypeError,
"PyModule_AddObject() needs module as first arg");
return -1;
}
dict = PyModule_GetDict(m);
if (dict == NULL)
if (dict == NULL) {
/* Internal error -- modules must have a dict! */
PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
PyModule_GetName(m));
return -1;
}
if (PyDict_SetItemString(dict, name, o))
return -1;
if (PyDict_SetItemString(dict, name, o))
return -1;
Py_DECREF(o);
return 0;
Py_DECREF(o);
return 0;
}
int
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment