Py_TYPE() has already dereferenced self before the NULL check. Moved Py_TYPE() after the check for self == NULL

This commit is contained in:
Christian Heimes 2012-09-10 02:45:56 +02:00
commit f03572d040
1 changed files with 2 additions and 1 deletions

View File

@ -219,7 +219,7 @@ method_repr(PyMethodObject *a)
{
PyObject *self = a->im_self;
PyObject *func = a->im_func;
PyObject *klass = (PyObject*)Py_TYPE(self);
PyObject *klass;
PyObject *funcname = NULL ,*klassname = NULL, *result = NULL;
char *defname = "?";
@ -227,6 +227,7 @@ method_repr(PyMethodObject *a)
PyErr_BadInternalCall();
return NULL;
}
klass = (PyObject*)Py_TYPE(self);
funcname = _PyObject_GetAttrId(func, &PyId___name__);
if (funcname == NULL) {