[pypy-commit] pypy ffi-backend: Next passing test

arigo noreply at buildbot.pypy.org
Wed Jul 4 08:28:06 CEST 2012


Author: Armin Rigo <arigo at tunes.org>
Branch: ffi-backend
Changeset: r55914:fbbf47abf4ca
Date: 2012-07-04 05:18 +0200
http://bitbucket.org/pypy/pypy/changeset/fbbf47abf4ca/

Log:	Next passing test

diff --git a/pypy/module/_cffi_backend/ctypestruct.py b/pypy/module/_cffi_backend/ctypestruct.py
--- a/pypy/module/_cffi_backend/ctypestruct.py
+++ b/pypy/module/_cffi_backend/ctypestruct.py
@@ -3,7 +3,7 @@
 """
 
 from pypy.interpreter.error import OperationError, operationerrfmt
-from pypy.rpython.lltypesystem import lltype, rffi
+from pypy.rpython.lltypesystem import lltype, llmemory, rffi
 from pypy.interpreter.baseobjspace import Wrappable
 from pypy.interpreter.typedef import TypeDef, interp_attrproperty
 from pypy.rlib.objectmodel import keepalive_until_here
diff --git a/pypy/module/_cffi_backend/test/test_c.py b/pypy/module/_cffi_backend/test/test_c.py
--- a/pypy/module/_cffi_backend/test/test_c.py
+++ b/pypy/module/_cffi_backend/test/test_c.py
@@ -36,6 +36,12 @@
             ptr = ctypes.pointer(testfunc6_static)
             return ctypes.cast(ptr, ctypes.c_void_p).value
 
+        class _testfunc7_s(ctypes.Structure):
+            _fields_ = [('a1', ctypes.c_ubyte),
+                        ('a2', ctypes.c_short)]
+        def testfunc7(inlined):
+            return inlined.a1 + inlined.a2
+
         def prepfunc(func, argtypes, restype):
             c_func = ctypes.CFUNCTYPE(restype, *argtypes)(func)
             keepalive_funcs.append(c_func)
@@ -51,17 +57,19 @@
                     prepfunc(operator.add,    # testfunc2
                              (ctypes.c_longlong, ctypes.c_longlong),
                              ctypes.c_longlong),
-                    prepfunc(operator.add,    # testfunc3,
+                    prepfunc(operator.add,    # testfunc3
                              (ctypes.c_float, ctypes.c_double),
                              ctypes.c_double),
-                    prepfunc(operator.add,    # testfunc4,
+                    prepfunc(operator.add,    # testfunc4
                              (ctypes.c_float, ctypes.c_double),
                              ctypes.c_float),
-                    prepfunc(lambda: None,    # testfunc5,
+                    prepfunc(lambda: None,    # testfunc5
                              (), None),
-                    prepfunc(testfunc6,       # testfunc6,
+                    prepfunc(testfunc6,       # testfunc6
                              (ctypes.POINTER(ctypes.c_int),),
                              ctypes.c_void_p),
+                    prepfunc(testfunc7,       # testfunc7
+                             (_testfunc7_s,), ctypes.c_short),
                     ]
                 testfuncs_w[:] = [space.wrap(addr) for addr in testfuncs]
             return testfuncs_w[space.int_w(w_num)]


More information about the pypy-commit mailing list