Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r66256:fb08a7c4671e Date: 2013-08-20 14:20 +0200 http://bitbucket.org/pypy/pypy/changeset/fb08a7c4671e/
Log: Backed out changeset ee2311d4ba26 diff --git a/pypy/interpreter/buffer.py b/pypy/interpreter/buffer.py --- a/pypy/interpreter/buffer.py +++ b/pypy/interpreter/buffer.py @@ -19,7 +19,7 @@ from pypy.interpreter.typedef import TypeDef from pypy.interpreter.gateway import interp2app, unwrap_spec from pypy.interpreter.error import OperationError -from rpython.rlib.objectmodel import compute_hash, import_from_mixin +from rpython.rlib.objectmodel import compute_hash from rpython.rlib.rstring import StringBuilder @@ -272,6 +272,8 @@ # ____________________________________________________________ class SubBufferMixin(object): + _mixin_ = True + def __init__(self, buffer, offset, size): self.buffer = buffer self.offset = offset @@ -295,11 +297,10 @@ # out of bounds return self.buffer.getslice(self.offset + start, self.offset + stop, step, size) -class SubBuffer(Buffer): - import_from_mixin(SubBufferMixin) +class SubBuffer(SubBufferMixin, Buffer): + pass -class RWSubBuffer(RWBuffer): - import_from_mixin(SubBufferMixin) +class RWSubBuffer(SubBufferMixin, RWBuffer): def setitem(self, index, char): self.buffer.setitem(self.offset + index, char) diff --git a/pypy/objspace/descroperation.py b/pypy/objspace/descroperation.py --- a/pypy/objspace/descroperation.py +++ b/pypy/objspace/descroperation.py @@ -121,7 +121,7 @@ greens=['w_type'], reds='auto') class DescrOperation(object): - # This is meant to be a *mixin*. + _mixin_ = True def is_data_descr(space, w_obj): return space.lookup(w_obj, '__set__') is not None diff --git a/pypy/objspace/std/objspace.py b/pypy/objspace/std/objspace.py --- a/pypy/objspace/std/objspace.py +++ b/pypy/objspace/std/objspace.py @@ -10,7 +10,7 @@ from rpython.rlib.objectmodel import instantiate, specialize, is_annotation_constant from rpython.rlib.debug import make_sure_not_resized from rpython.rlib.rarithmetic import base_int, widen, is_valid_int -from rpython.rlib.objectmodel import we_are_translated, import_from_mixin +from rpython.rlib.objectmodel import we_are_translated from rpython.rlib import jit # Object imports @@ -37,10 +37,9 @@ from pypy.objspace.std.stringtype import wrapstr from pypy.objspace.std.unicodetype import wrapunicode -class StdObjSpace(ObjSpace): +class StdObjSpace(ObjSpace, DescrOperation): """The standard object space, implementing a general-purpose object library in Restricted Python.""" - import_from_mixin(DescrOperation) def initialize(self): "NOT_RPYTHON: only for initializing the space." diff --git a/rpython/rlib/objectmodel.py b/rpython/rlib/objectmodel.py --- a/rpython/rlib/objectmodel.py +++ b/rpython/rlib/objectmodel.py @@ -737,8 +737,6 @@ """ flatten = {} for base in inspect.getmro(M): - if base is object: - continue for key, value in base.__dict__.items(): if key.startswith('__') and key.endswith('__'): if key not in special_methods: diff --git a/rpython/rlib/test/test_objectmodel.py b/rpython/rlib/test/test_objectmodel.py --- a/rpython/rlib/test/test_objectmodel.py +++ b/rpython/rlib/test/test_objectmodel.py @@ -612,12 +612,3 @@ import_from_mixin(M, special_methods=['__str__']) assert str(A()).startswith('<') assert str(B()) == "m!" - - class M(object): - pass - class A(object): - def __init__(self): - self.foo = 42 - class B(A): - import_from_mixin(M) - assert B().foo == 42 _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit