[pypy-svn] r62286 - in pypy/branch/pyjitpl5/pypy/rpython/lltypesystem: . test

fijal at codespeak.net fijal at codespeak.net
Sun Mar 1 11:15:28 CET 2009


Author: fijal
Date: Sun Mar  1 11:15:28 2009
New Revision: 62286

Modified:
   pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/ll2ctypes.py
   pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
Log:
void args. also a hack for exceptions in x86 backend, not tested yet


Modified: pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/ll2ctypes.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/ll2ctypes.py	(original)
+++ pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/ll2ctypes.py	Sun Mar  1 11:15:28 2009
@@ -15,7 +15,7 @@
 from pypy.tool.tls import tlsobject
 from pypy.rlib.rarithmetic import r_uint, r_singlefloat
 from pypy.annotation import model as annmodel
-from pypy.rpython.llinterp import LLInterpreter
+from pypy.rpython.llinterp import LLInterpreter, LLException
 from pypy.rpython.lltypesystem.rclass import OBJECT
 from pypy.rpython.annlowlevel import base_ptr_lltype
 from pypy.rpython import raddress
@@ -23,7 +23,6 @@
 def uaddressof(obj):
     return fixid(ctypes.addressof(obj))
 
-
 _ctypes_cache = {}
 _eci_cache = {}
 
@@ -553,7 +552,11 @@
                     if LLInterpreter.current_interpreter is None:
                         raise AssertionError
                     llinterp = LLInterpreter.current_interpreter
-                    llres = llinterp.eval_graph(container.graph, llargs)
+                    try:
+                        llres = llinterp.eval_graph(container.graph, llargs)
+                    except LLException, lle:
+                        llinterp._store_exception(lle)
+                        return 0
                 else:
                     llres = container._callable(*llargs)
                 assert lltype.typeOf(llres) == T.TO.RESULT
@@ -651,6 +654,8 @@
     """Convert the ctypes object 'cobj' to its lltype equivalent.
     'T' is the expected lltype type.
     """
+    if T is lltype.Void:
+        return None
     if isinstance(T, lltype.Ptr):
         if not cobj:   # NULL pointer
             return lltype.nullptr(T.TO)

Modified: pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
==============================================================================
--- pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/test/test_ll2ctypes.py	(original)
+++ pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/test/test_ll2ctypes.py	Sun Mar  1 11:15:28 2009
@@ -978,3 +978,4 @@
         assert v
         v2 = ctypes2lltype(llmemory.GCREF, ctypes.c_void_p(1235))
         assert v2 != v
+        



More information about the Pypy-commit mailing list