summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Heimes <christian@cheimes.de>2012-09-10 00:45:31 (GMT)
committerChristian Heimes <christian@cheimes.de>2012-09-10 00:45:31 (GMT)
commit949f3317312c64425efae21bda86b98423aac9cf (patch)
treee8adc528ca62b6ce58d53b995b6366df018519dd
parent941bfcc537a25077e2a73ddf8d8b3bfe288c81f4 (diff)
downloadcpython-949f3317312c64425efae21bda86b98423aac9cf.zip
cpython-949f3317312c64425efae21bda86b98423aac9cf.tar.gz
cpython-949f3317312c64425efae21bda86b98423aac9cf.tar.bz2
Py_TYPE() has already dereferenced self before the NULL check. Moved Py_TYPE() after the check for self == NULL
-rw-r--r--Objects/classobject.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/Objects/classobject.c b/Objects/classobject.c
index b7d35ef..f956852 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) {