]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
backport gvanrossum's checkin of
authorMichael W. Hudson <mwh@python.net>
Fri, 5 Apr 2002 15:39:31 +0000 (15:39 +0000)
committerMichael W. Hudson <mwh@python.net>
Fri, 5 Apr 2002 15:39:31 +0000 (15:39 +0000)
    revision 2.133 of typeobject.c

SF patch 537536 by Phillip J. Eby, fix for SF bug 535444, super()
broken w/ classmethods.

Bugfix candidate.

Objects/typeobject.c

index c938f524536d527b63e17739ab62a0aa3f4dd95e..bc7a189c1d00c498cdc48daf88ff5cd3ef6c21f6 100644 (file)
@@ -3994,10 +3994,13 @@ super_getattro(PyObject *self, PyObject *name)
 
        if (su->obj != NULL) {
                PyObject *mro, *res, *tmp, *dict;
+               PyTypeObject *starttype;
                descrgetfunc f;
                int i, n;
 
-               mro = su->obj->ob_type->tp_mro;
+               starttype = su->obj->ob_type;
+               mro = starttype->tp_mro;
+
                if (mro == NULL)
                        n = 0;
                else {
@@ -4009,7 +4012,8 @@ super_getattro(PyObject *self, PyObject *name)
                                break;
                }
                if (i >= n && PyType_Check(su->obj)) {
-                       mro = ((PyTypeObject *)(su->obj))->tp_mro;
+                       starttype = (PyTypeObject *)(su->obj);
+                       mro = starttype->tp_mro;
                        if (mro == NULL)
                                n = 0;
                        else {
@@ -4037,7 +4041,7 @@ super_getattro(PyObject *self, PyObject *name)
                                Py_INCREF(res);
                                f = res->ob_type->tp_descr_get;
                                if (f != NULL) {
-                                       tmp = f(res, su->obj, res);
+                                       tmp = f(res, su->obj, (PyObject *)starttype);
                                        Py_DECREF(res);
                                        res = tmp;
                                }