[pypy-svn] r60022 - pypy/branch/oo-jit/pypy/rpython/lltypesystem

arigo at codespeak.net arigo at codespeak.net
Thu Nov 20 15:17:56 CET 2008


Author: arigo
Date: Thu Nov 20 15:17:55 2008
New Revision: 60022

Modified:
   pypy/branch/oo-jit/pypy/rpython/lltypesystem/ll2ctypes.py
Log:
More fix in ll2ctypes: lltype2ctypes gives an object of
exactly the same type, even if this type is a ptr to
function returning a non-integer.


Modified: pypy/branch/oo-jit/pypy/rpython/lltypesystem/ll2ctypes.py
==============================================================================
--- pypy/branch/oo-jit/pypy/rpython/lltypesystem/ll2ctypes.py	(original)
+++ pypy/branch/oo-jit/pypy/rpython/lltypesystem/ll2ctypes.py	Thu Nov 20 15:17:55 2008
@@ -495,9 +495,12 @@
                 TMod = lltype.Ptr(lltype.FuncType(T.TO.ARGS,
                                                   lltype.Signed))
                 ctypes_func_type = get_ctypes_type(rtyper, TMod)
+                res = ctypes_func_type(callback)
+                ctypes_func_type = get_ctypes_type(rtyper, T)
+                res = ctypes.cast(res, ctypes_func_type)
             else:
                 ctypes_func_type = get_ctypes_type(rtyper, T)
-            res = ctypes_func_type(callback)
+                res = ctypes_func_type(callback)
             _all_callbacks.append(res)
             _callback2obj[ctypes.cast(res, ctypes.c_void_p).value] = container
             return res



More information about the Pypy-commit mailing list