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

arigo pypy.commits at gmail.com
Sun Oct 8 12:58:08 EDT 2017


Author: Armin Rigo <arigo at tunes.org>
Branch: cpyext-avoid-roundtrip
Changeset: r92656:48682b264cfe
Date: 2017-10-08 18:57 +0200
http://bitbucket.org/pypy/pypy/changeset/48682b264cfe/

Log:	(antocuni, arigo)

	fix translation (1st step?)

diff --git a/pypy/module/cpyext/api.py b/pypy/module/cpyext/api.py
--- a/pypy/module/cpyext/api.py
+++ b/pypy/module/cpyext/api.py
@@ -262,6 +262,10 @@
         self.functype = lltype.Ptr(lltype.FuncType(argtypes, restype))
         self.callable = callable
         self.cdecl = None    # default
+        #
+        def get_llhelper(space):
+            return llhelper(self.functype, self.get_wrapper(space))
+        self.get_llhelper = get_llhelper
 
     def get_api_decl(self, name, c_writer):
         restype = self.get_c_restype(c_writer)
@@ -335,10 +339,6 @@
         self.gil = gil
         self.result_borrowed = result_borrowed
         self.result_is_ll = result_is_ll
-        #
-        def get_llhelper(space):
-            return llhelper(self.functype, self.get_wrapper(space))
-        self.get_llhelper = get_llhelper
 
     def _freeze_(self):
         return True
@@ -478,12 +478,8 @@
 class COnlyApiFunction(BaseApiFunction):
     API_VISIBILITY = "extern %s"
 
-    def __init__(self, *args, **kwds):
-        BaseApiFunction.__init__(self, *args, **kwds)
-        #
-        def get_llhelper(space):
-            return llhelper(self.functype, self.callable)
-        self.get_llhelper = get_llhelper
+    def get_wrapper(self, space):
+        return self.callable
 
     def __call__(self, *args):
         raise TypeError("the function %s should not be directly "


More information about the pypy-commit mailing list