Py_TYPE() has already dereferenced self before the NULL check. Moved Py_TYPE() after...
authorChristian Heimes <christian@cheimes.de>
Mon, 10 Sep 2012 00:45:31 +0000 (02:45 +0200)
committerChristian Heimes <christian@cheimes.de>
Mon, 10 Sep 2012 00:45:31 +0000 (02:45 +0200)
Objects/classobject.c

index b7d35ef8852e39ce1f904b4ae7512c3b3f522223..f9568527b366b8017537d665275d06090a606500 100644 (file)
@@ -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) {