[pypy-commit] pypy cffi-handle-lifetime: jit translation fix

arigo noreply at buildbot.pypy.org
Mon Oct 12 19:38:48 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: cffi-handle-lifetime
Changeset: r80144:10debcf2b5c5
Date: 2015-10-12 18:16 +0100
http://bitbucket.org/pypy/pypy/changeset/10debcf2b5c5/

Log:	jit translation fix

diff --git a/pypy/module/_cffi_backend/ccallback.py b/pypy/module/_cffi_backend/ccallback.py
--- a/pypy/module/_cffi_backend/ccallback.py
+++ b/pypy/module/_cffi_backend/ccallback.py
@@ -19,6 +19,7 @@
 # ____________________________________________________________
 
 
+ at jit.dont_look_inside
 def make_callback(space, ctype, w_callable, w_error, w_onerror):
     # Allocate a callback as a nonmovable W_CDataCallback instance, which
     # we can cast to a plain VOIDP.  As long as the object is not freed,
diff --git a/pypy/module/_cffi_backend/handle.py b/pypy/module/_cffi_backend/handle.py
--- a/pypy/module/_cffi_backend/handle.py
+++ b/pypy/module/_cffi_backend/handle.py
@@ -38,9 +38,12 @@
                     "expected a 'cdata' object with a 'void *' out of "
                     "new_handle(), got '%s'", ctype.name)
     with w_cdata as ptr:
-        addr = rffi.cast(llmemory.Address, ptr)
-        gcref = rgc.reveal_gcref(addr)
-    #
+        return _reveal(space, ptr)
+
+ at jit.dont_look_inside
+def _reveal(space, ptr):
+    addr = rffi.cast(llmemory.Address, ptr)
+    gcref = rgc.reveal_gcref(addr)
     if not gcref:
         raise oefmt(space.w_RuntimeError,
                     "cannot use from_handle() on NULL pointer")


More information about the pypy-commit mailing list