[pypy-commit] pypy cpyext-avoid-roundtrip: (ronan, antocuni, arigo)

arigo pypy.commits at gmail.com
Sun Oct 1 12:39:37 EDT 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: cpyext-avoid-roundtrip
Changeset: r92535:804bbd063a8a
Date: 2017-10-01 18:39 +0200
http://bitbucket.org/pypy/pypy/changeset/804bbd063a8a/

Log:	(ronan, antocuni, arigo)

	Small change to prepare the subtype_dealloc() attack

diff --git a/pypy/module/cpyext/pyobject.py b/pypy/module/cpyext/pyobject.py
--- a/pypy/module/cpyext/pyobject.py
+++ b/pypy/module/cpyext/pyobject.py
@@ -26,9 +26,9 @@
     basestruct = PyObject.TO
     W_BaseObject = W_ObjectObject
 
-    def get_dealloc(self):
+    def get_dealloc(self, space):
         from pypy.module.cpyext.typeobject import subtype_dealloc
-        return subtype_dealloc.api_func
+        return subtype_dealloc.api_func.get_llhelper(space)
 
     def allocate(self, space, w_type, itemcount=0, immortal=False):
         # typically called from PyType_GenericAlloc via typedescr.allocate
@@ -107,8 +107,8 @@
                 return tp_alloc(space, w_type, itemcount)
 
         if tp_dealloc:
-            def get_dealloc(self):
-                return tp_dealloc.api_func
+            def get_dealloc(self, space):
+                return tp_dealloc.api_func.get_llhelper(space)
 
         if tp_attach:
             def attach(self, space, pyobj, w_obj, w_userdata=None):
diff --git a/pypy/module/cpyext/typeobject.py b/pypy/module/cpyext/typeobject.py
--- a/pypy/module/cpyext/typeobject.py
+++ b/pypy/module/cpyext/typeobject.py
@@ -758,7 +758,7 @@
     # dealloc
     if space.gettypeobject(w_type.layout.typedef) is w_type:
         # only for the exact type, like 'space.w_tuple' or 'space.w_list'
-        pto.c_tp_dealloc = typedescr.get_dealloc().get_llhelper(space)
+        pto.c_tp_dealloc = typedescr.get_dealloc(space)
     else:
         # for all subtypes, use base's dealloc (requires sorting in attach_all)
         pto.c_tp_dealloc = pto.c_tp_base.c_tp_dealloc


More information about the pypy-commit mailing list