This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author scoder
Recipients docs@python, scoder
Date 2011-09-09.16:19:51
SpamBayes Score 0.00015772601
Marked as misclassified No
Message-id <1315585192.34.0.742122652176.issue12946@psf.upfronthosting.co.za>
In-reply-to
Content
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;
}
History
Date User Action Args
2011-09-09 16:19:52scodersetrecipients: + scoder, docs@python
2011-09-09 16:19:52scodersetmessageid: <1315585192.34.0.742122652176.issue12946@psf.upfronthosting.co.za>
2011-09-09 16:19:51scoderlinkissue12946 messages
2011-09-09 16:19:51scodercreate