comparison Python/ceval.c @ 6139:a287c5014e66 legacy-trunk

Reverse the search order for the Don Beaudry hook so that the first class wins. Makes more sense.
author Guido van Rossum <guido@python.org>
date Fri, 22 Aug 1997 16:56:16 +0000
parents 5a4d181ffffd
children b76a44163e0f
comparison
equal deleted inserted replaced
6138:f80e763c1717 6139:a287c5014e66
2681 build_class(methods, bases, name) 2681 build_class(methods, bases, name)
2682 PyObject *methods; /* dictionary */ 2682 PyObject *methods; /* dictionary */
2683 PyObject *bases; /* tuple containing classes */ 2683 PyObject *bases; /* tuple containing classes */
2684 PyObject *name; /* string */ 2684 PyObject *name; /* string */
2685 { 2685 {
2686 int i; 2686 int i, n;
2687 if (!PyTuple_Check(bases)) { 2687 if (!PyTuple_Check(bases)) {
2688 PyErr_SetString(PyExc_SystemError, 2688 PyErr_SetString(PyExc_SystemError,
2689 "build_class with non-tuple bases"); 2689 "build_class with non-tuple bases");
2690 return NULL; 2690 return NULL;
2691 } 2691 }
2697 if (!PyString_Check(name)) { 2697 if (!PyString_Check(name)) {
2698 PyErr_SetString(PyExc_SystemError, 2698 PyErr_SetString(PyExc_SystemError,
2699 "build_class witn non-string name"); 2699 "build_class witn non-string name");
2700 return NULL; 2700 return NULL;
2701 } 2701 }
2702 for (i = PyTuple_Size(bases); --i >= 0; ) { 2702 n = PyTuple_Size(bases);
2703 /* XXX Is it intentional that the *last* base gets a 2703 for (i = 0; i < n; i++) {
2704 chance at this first? */
2705 PyObject *base = PyTuple_GET_ITEM(bases, i); 2704 PyObject *base = PyTuple_GET_ITEM(bases, i);
2706 if (!PyClass_Check(base)) { 2705 if (!PyClass_Check(base)) {
2707 /* Call the base's *type*, if it is callable. 2706 /* Call the base's *type*, if it is callable.
2708 This code is a hook for Donald Beaudry's 2707 This code is a hook for Donald Beaudry's
2709 and Jim Fulton's type extensions. In 2708 and Jim Fulton's type extensions. In