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

fijal at codespeak.net fijal at codespeak.net
Mon Nov 24 16:33:29 CET 2008


Author: fijal
Date: Mon Nov 24 16:33:29 2008
New Revision: 60116

Modified:
   pypy/branch/oo-jit/pypy/rpython/lltypesystem/ll2ctypes.py
Log:
fix casts


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	Mon Nov 24 16:33:29 2008
@@ -455,7 +455,8 @@
         return _opaque_cache[llobj]
     except KeyError:
         assert len(_opaque_cache) == len(_opaque_list)
-        val = ctypes.cast(len(_opaque_cache), ctypes.c_void_p)
+        ctypes_type = get_ctypes_type(None, base_ptr_lltype())
+        val = ctypes.cast(len(_opaque_cache), ctypes_type)
         _opaque_list.append(llobj)
         _opaque_cache[llobj] = val
         return val
@@ -578,7 +579,7 @@
         if not cobj:   # NULL pointer
             return lltype.nullptr(T.TO)
         if T is base_ptr_lltype():
-            return _opaque_list[cobj]
+            return _opaque_list[ctypes.cast(cobj, ctypes.c_void_p).value]
         if isinstance(T.TO, lltype.Struct):
             if T.TO._arrayfld is not None:
                 carray = getattr(cobj.contents, T.TO._arrayfld)



More information about the Pypy-commit mailing list