Author: mattip <matti.pi...@gmail.com> Branch: py3k Changeset: r73076:b3072cefc086 Date: 2014-08-26 23:09 +0300 http://bitbucket.org/pypy/pypy/changeset/b3072cefc086/
Log: back out changeset: f7c113013604, breaks translation diff --git a/pypy/module/cpyext/buffer.py b/pypy/module/cpyext/buffer.py --- a/pypy/module/cpyext/buffer.py +++ b/pypy/module/cpyext/buffer.py @@ -1,5 +1,6 @@ from rpython.rtyper.lltypesystem import rffi, lltype from rpython.rlib import buffer +from rpython.rlib.objectmodel import import_from_mixin from pypy.module.cpyext.api import ( cpython_api, CANNOT_FAIL, Py_buffer) from pypy.module.cpyext.pyobject import PyObject, Py_DecRef @@ -12,8 +13,7 @@ # PyPy only supports contiguous Py_buffers for now. return 1 -class CBuffer(buffer.Buffer): - _immutable_ = True +class CBufferMixin(object): def __init__(self, space, c_buf, c_len, w_obj): self.space = space @@ -21,7 +21,8 @@ self.c_len = c_len self.w_obj = w_obj - def __del__(self): + def destructor(self): + assert isinstance(self, CBufferMixin) Py_DecRef(self.space, self.w_obj) def getlength(self): @@ -33,3 +34,10 @@ def as_str(self): return rffi.charpsize2str(rffi.cast(rffi.CCHARP, self.c_buf), self.c_len) + +class CBuffer(buffer.Buffer): + import_from_mixin(CBufferMixin) + _immutable_ = True + + def __del__(self): + CBufferMixin.destructor(self) _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit