[pypy-commit] pypy cffi-new-allocator: translation fixes

arigo noreply at buildbot.pypy.org
Mon Jul 6 18:35:40 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-new-allocator
Changeset: r78466:799b38e51757
Date: 2015-07-06 17:50 +0200
http://bitbucket.org/pypy/pypy/changeset/799b38e51757/

Log:	translation fixes

diff --git a/pypy/module/_cffi_backend/cdataobj.py b/pypy/module/_cffi_backend/cdataobj.py
--- a/pypy/module/_cffi_backend/cdataobj.py
+++ b/pypy/module/_cffi_backend/cdataobj.py
@@ -430,6 +430,13 @@
     _attrs_ = ['w_free']
 
     def __del__(self):
+        self.clear_all_weakrefs()
+        self.enqueue_for_destruction(self.space,
+                                     W_CDataNewNonStdFree.call_destructor,
+                                     'destructor of ')
+
+    def call_destructor(self):
+        assert isinstance(self, W_CDataNewNonStdFree)
         self.space.call_function(self.w_free, self.w_raw_cdata)
 
 
@@ -519,6 +526,12 @@
         self.w_destructor = w_destructor
 
     def __del__(self):
+        self.clear_all_weakrefs()
+        self.enqueue_for_destruction(self.space, W_CDataGCP.call_destructor,
+                                     'destructor of ')
+
+    def call_destructor(self):
+        assert isinstance(self, W_CDataGCP)
         self.space.call_function(self.w_destructor, self.w_original_cdata)
 
 


More information about the pypy-commit mailing list