diff Objects/classobject.c @ 78934:dcddbd41f08b 3.2

Py_TYPE() has already dereferenced self before the NULL check. Moved Py_TYPE() after the check for self == NULL
author Christian Heimes <christian@cheimes.de>
date Mon, 10 Sep 2012 02:45:31 +0200
parents 4b724884c81f
children 39e3f06cf6f0
line wrap: on
line diff
--- a/Objects/classobject.c	Mon Sep 10 00:27:55 2012 +0200
+++ b/Objects/classobject.c	Mon Sep 10 02:45:31 2012 +0200
@@ -218,7 +218,7 @@
 {
     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 @@
         PyErr_BadInternalCall();
         return NULL;
     }
+    klass = (PyObject*)Py_TYPE(self);
 
     funcname = PyObject_GetAttrString(func, "__name__");
     if (funcname == NULL) {