From: Christian Heimes Date: Mon, 10 Sep 2012 00:45:31 +0000 (+0200) Subject: Py_TYPE() has already dereferenced self before the NULL check. Moved Py_TYPE() after... X-Git-Tag: v3.2.4rc1~553 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=949f3317312c64425efae21bda86b98423aac9cf;p=thirdparty%2FPython%2Fcpython.git Py_TYPE() has already dereferenced self before the NULL check. Moved Py_TYPE() after the check for self == NULL --- diff --git a/Objects/classobject.c b/Objects/classobject.c index b7d35ef8852e..f9568527b366 100644 --- a/Objects/classobject.c +++ b/Objects/classobject.c @@ -218,7 +218,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 = "?"; @@ -226,6 +226,7 @@ method_repr(PyMethodObject *a) PyErr_BadInternalCall(); return NULL; } + klass = (PyObject*)Py_TYPE(self); funcname = PyObject_GetAttrString(func, "__name__"); if (funcname == NULL) {