viff

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 diff
     1.1 --- a/viff/runtime.py	Tue Oct 27 15:32:47 2009 +0100
     1.2 +++ b/viff/runtime.py	Tue Oct 27 15:35:18 2009 +0100
     1.3 @@ -947,10 +947,12 @@
     1.4      if mixins is None:
     1.5          return runtime_class
     1.6      else:
     1.7 -        # We must include at least one new-style class in bases. We
     1.8 -        # include it last to avoid overriding __init__ from the other
     1.9 -        # base classes.
    1.10 -        bases = (runtime_class,) + tuple(mixins) + (object,)
    1.11 +        # The order is important: we want the most specific classes to
    1.12 +        # go first so that they can override methods from later
    1.13 +        # classes. We must also include at least one new-style class
    1.14 +        # in bases -- we include it last to avoid overriding __init__
    1.15 +        # from the other base classes.
    1.16 +        bases = tuple(mixins) + (runtime_class, object)
    1.17          return type("ExtendedRuntime", bases, {})
    1.18  
    1.19  def create_runtime(id, players, threshold, options=None, runtime_class=None):