Skip to content

Commit

Permalink
Py_TYPE() has already dereferenced self before the NULL check. Moved …
Browse files Browse the repository at this point in the history
…Py_TYPE() after the check for self == NULL
  • Loading branch information
tiran committed Sep 10, 2012
2 parents 1b5c76a + 949f331 commit f03572d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Objects/classobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -219,14 +219,15 @@ 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 = "?";

if (self == NULL) {
PyErr_BadInternalCall();
return NULL;
}
klass = (PyObject*)Py_TYPE(self);

funcname = _PyObject_GetAttrId(func, &PyId___name__);
if (funcname == NULL) {
Expand Down

0 comments on commit f03572d

Please sign in to comment.