changeset 1377:73a79bf6c5d0

runtime: correct base class order
author Martin Geisler <mg@cs.au.dk>
date Tue, 27 Oct 2009 15:35:18 +0100
parents 98059854fc52
children 57b5234df725
files viff/runtime.py
diffstat 1 files changed, 6 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/viff/runtime.py	Tue Oct 27 15:32:47 2009 +0100
+++ b/viff/runtime.py	Tue Oct 27 15:35:18 2009 +0100
@@ -947,10 +947,12 @@
     if mixins is None:
         return runtime_class
     else:
-        # We must include at least one new-style class in bases. We
-        # include it last to avoid overriding __init__ from the other
-        # base classes.
-        bases = (runtime_class,) + tuple(mixins) + (object,)
+        # The order is important: we want the most specific classes to
+        # go first so that they can override methods from later
+        # classes. We must also include at least one new-style class
+        # in bases -- we include it last to avoid overriding __init__
+        # from the other base classes.
+        bases = tuple(mixins) + (runtime_class, object)
         return type("ExtendedRuntime", bases, {})
 
 def create_runtime(id, players, threshold, options=None, runtime_class=None):