[Python-checkins] cpython (merge 3.2 -> default): 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:22 CEST 2012


http://hg.python.org/cpython/rev/39e3f06cf6f0
changeset: 78935:39e3f06cf6f0
parent: 78933:6bd9626b0cc6
parent: 78934:dcddbd41f08b
user: Christian Heimes <christian at cheimes.de>
date: Mon Sep 10 02:45:56 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
@@ -219,7 +219,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 = "?";
 
@@ -227,6 +227,7 @@
 PyErr_BadInternalCall();
 return NULL;
 }
+ klass = (PyObject*)Py_TYPE(self);
 
 funcname = _PyObject_GetAttrId(func, &PyId___name__);
 if (funcname == NULL) {
-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /