Message143764
As is obvious from the code, PyModule_GetDict() can fail if being passed a non-module object, and when the (unlikely) dict creation at the end fails. The documentation of the C-API function should be fixed to reflect that, i.e. it should state that NULL is returned in the case of an error.
PyObject *
PyModule_GetDict(PyObject *m)
{
PyObject *d;
if (!PyModule_Check(m)) {
PyErr_BadInternalCall();
return NULL;
}
d = ((PyModuleObject *)m) -> md_dict;
if (d == NULL)
((PyModuleObject *)m) -> md_dict = d = PyDict_New();
return d;
} |
|
Date |
User |
Action |
Args |
2011-09-09 16:19:52 | scoder | set | recipients:
+ scoder, docs@python |
2011-09-09 16:19:52 | scoder | set | messageid: <1315585192.34.0.742122652176.issue12946@psf.upfronthosting.co.za> |
2011-09-09 16:19:51 | scoder | link | issue12946 messages |
2011-09-09 16:19:51 | scoder | create | |
|