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

arigo at codespeak.net arigo at codespeak.net
Thu Mar 12 12:09:04 CET 2009


Author: arigo
Date: Thu Mar 12 12:09:03 2009
New Revision: 62876

Modified:
   pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/ll2ctypes.py
   pypy/branch/pyjitpl5/pypy/rpython/lltypesystem/test/test_ll2ctypes.py
Log:
Fix jit/backend/x86/test_send by removing this code.
Requires adding a "normalize=False" argument to a test
in test_ll2ctypes, which I think is ok (see comment).


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	Thu Mar 12 12:09:03 2009
@@ -626,13 +626,7 @@
             p = ctypes.c_void_p(p.value + index)
             c_tp = get_ctypes_type(T.TO)
             storage._normalized_ctype = c_tp
-        if normalize and getattr(T.TO, '_arrayfld', None):
-            # XXX doesn't cache
-            c_tp = build_ctypes_struct(T.TO, [],
-                         len(getattr(storage, T.TO._arrayfld).items))
-            # make sure you cache according to the len() above!
-            p = ctypes.cast(p, ctypes.POINTER(c_tp))
-        elif normalize and hasattr(storage, '_normalized_ctype'):
+        if normalize and hasattr(storage, '_normalized_ctype'):
             p = ctypes.cast(p, ctypes.POINTER(storage._normalized_ctype))
         return p
 

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	Thu Mar 12 12:09:03 2009
@@ -120,7 +120,10 @@
         a.y[0] = 'x'
         a.y[1] = 'y'
         a.y[2] = 'z'
-        ac = lltype2ctypes(a)
+        # we need to pass normalize=False, otherwise 'ac' is returned of
+        # a normalized standard type, which complains about IndexError
+        # when doing 'ac.contents.y.items[2]'.
+        ac = lltype2ctypes(a, normalize=False)
         assert ac.contents.y.length == 3
         assert ac.contents.y.items[2] == ord('z')
         lltype.free(a, flavor='raw')



More information about the Pypy-commit mailing list