Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r66258:75e2865eba64 Date: 2013-08-20 14:24 +0200 http://bitbucket.org/pypy/pypy/changeset/75e2865eba64/
Log: Example of a simple case for import_from_mixin(). 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 +from rpython.rlib.objectmodel import compute_hash, import_from_mixin from rpython.rlib.rstring import StringBuilder @@ -272,8 +272,6 @@ # ____________________________________________________________ class SubBufferMixin(object): - _mixin_ = True - def __init__(self, buffer, offset, size): self.buffer = buffer self.offset = offset @@ -297,10 +295,11 @@ # out of bounds return self.buffer.getslice(self.offset + start, self.offset + stop, step, size) -class SubBuffer(SubBufferMixin, Buffer): - pass +class SubBuffer(Buffer): + import_from_mixin(SubBufferMixin) -class RWSubBuffer(SubBufferMixin, RWBuffer): +class RWSubBuffer(RWBuffer): + import_from_mixin(SubBufferMixin) def setitem(self, index, char): self.buffer.setitem(self.offset + index, char) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit