Armin Rigo  committed dad9e6b

Fix cpyext/ Add an operation to

  • Participants
  • Parent commits 672b7f7
  • Branches gc-del

Comments (0)

Files changed (2)

File pypy/module/cpyext/

 from pypy.objspace.std.objectobject import W_ObjectObject
 from rpython.rlib.objectmodel import specialize, we_are_translated
 from rpython.rlib.rweakref import RWeakKeyDictionary
+from rpython.rlib import rgc
 from rpython.rtyper.annlowlevel import llhelper
     def __init__(self, space, pyo):
         self.pyo = pyo = space
+        rgc.register_finalizer(self.finalizer)
-    def __del__(self):
+    def finalizer(self):
         if self.pyo:
             assert self.pyo.c_ob_refcnt == 0
             _Py_Dealloc(, self.pyo)

File rpython/translator/backendopt/

     * anything that escapes self
     * anything that can allocate
-    ok_operations = ['ptr_nonzero', 'ptr_eq', 'ptr_ne', 'free', 'same_as',
+    ok_operations = ['ptr_nonzero', 'ptr_iszero', 'ptr_eq', 'ptr_ne',
+                     'free', 'same_as',
                      'direct_ptradd', 'force_cast', 'track_alloc_stop',