Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit cd64965

Browse files
committed
Reverse the search order for the Don Beaudry hook so that the first
class wins. Makes more sense.
1 parent 289f97d commit cd64965

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

Python/ceval.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,7 +2683,7 @@ build_class(methods, bases, name)
26832683
PyObject *bases; /* tuple containing classes */
26842684
PyObject *name; /* string */
26852685
{
2686-
int i;
2686+
int i, n;
26872687
if (!PyTuple_Check(bases)) {
26882688
PyErr_SetString(PyExc_SystemError,
26892689
"build_class with non-tuple bases");
@@ -2699,9 +2699,8 @@ build_class(methods, bases, name)
26992699
"build_class witn non-string name");
27002700
return NULL;
27012701
}
2702-
for (i = PyTuple_Size(bases); --i >= 0; ) {
2703-
/* XXX Is it intentional that the *last* base gets a
2704-
chance at this first? */
2702+
n = PyTuple_Size(bases);
2703+
for (i = 0; i < n; i++) {
27052704
PyObject *base = PyTuple_GET_ITEM(bases, i);
27062705
if (!PyClass_Check(base)) {
27072706
/* Call the base's *type*, if it is callable.

0 commit comments

Comments
 (0)