[pypy-commit] pypy py3k: Fix translation

amauryfa noreply at buildbot.pypy.org
Mon Dec 3 00:58:35 CET 2012


Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
Branch: py3k
Changeset: r59277:6dd3cc751054
Date: 2012-12-03 00:57 +0100
http://bitbucket.org/pypy/pypy/changeset/6dd3cc751054/

Log:	Fix 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
@@ -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):
@@ -31,7 +32,10 @@
         return self.c_buf[index]
 
     def as_str(self):
-        return rffi.charpsize2str(self.c_buf, self.c_len)
+        return rffi.charpsize2str(rffi.cast(rffi.CCHARP, self.c_buf),
+                                  self.c_len)
         
 class CBuffer(CBufferMixin, buffer.Buffer):
-    pass
+    def __del__(self):
+        self.enqueue_for_destruction(self.space, CBufferMixin.destructor,
+                                     'internal __del__ of ')


More information about the pypy-commit mailing list