[Python-checkins] cpython (3.2): Py_TYPE() has already dereferenced self before the NULL check. Moved Py_TYPE()
christian.heimes
python-checkins at python.org
Mon Sep 10 02:46:20 CEST 2012
http://hg.python.org/cpython/rev/dcddbd41f08b
changeset: 78934:dcddbd41f08b
branch: 3.2
parent: 78929:d85f80b31b54
user: Christian Heimes <christian at cheimes.de>
date: Mon Sep 10 02:45:31 2012 +0200
summary:
Py_TYPE() has already dereferenced self before the NULL check. Moved Py_TYPE() after the check for self == NULL
files:
Objects/classobject.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Objects/classobject.c b/Objects/classobject.c
--- a/Objects/classobject.c
+++ b/Objects/classobject.c
@@ -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) {
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list