[pypy-commit] pypy py3k: (mattip) fix test_fillWithObject

pjenvey noreply at buildbot.pypy.org
Tue Aug 26 19:58:28 CEST 2014


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r73070:f7c113013604
Date: 2014-08-26 10:56 -0700
http://bitbucket.org/pypy/pypy/changeset/f7c113013604/

Log:	(mattip) fix test_fillWithObject

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,6 +1,5 @@
 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
@@ -13,7 +12,8 @@
     # PyPy only supports contiguous Py_buffers for now.
     return 1
 
-class CBufferMixin(object):
+class CBuffer(buffer.Buffer):
+    _immutable_ = True
 
     def __init__(self, space, c_buf, c_len, w_obj):
         self.space = space
@@ -21,8 +21,7 @@
         self.c_len = c_len
         self.w_obj = w_obj
 
-    def destructor(self):
-        assert isinstance(self, CBufferMixin)
+    def __del__(self):
         Py_DecRef(self.space, self.w_obj)
 
     def getlength(self):
@@ -34,10 +33,3 @@
     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)


More information about the pypy-commit mailing list