[pypy-svn] r72473 - in pypy/branch/rawffi-64/pypy/module/_rawffi: . test

arigo at codespeak.net arigo at codespeak.net
Sat Mar 20 20:16:16 CET 2010


Author: arigo
Date: Sat Mar 20 20:16:14 2010
New Revision: 72473

Modified:
   pypy/branch/rawffi-64/pypy/module/_rawffi/callback.py
   pypy/branch/rawffi-64/pypy/module/_rawffi/test/test__rawffi.py
Log:
Test and fix.


Modified: pypy/branch/rawffi-64/pypy/module/_rawffi/callback.py
==============================================================================
--- pypy/branch/rawffi-64/pypy/module/_rawffi/callback.py	(original)
+++ pypy/branch/rawffi-64/pypy/module/_rawffi/callback.py	Sat Mar 20 20:16:14 2010
@@ -10,6 +10,7 @@
      wrap_value, unwrap_value, unwrap_truncate_int, \
      unpack_argshapes, unpack_resshape
 from pypy.rlib.libffi import USERDATA_P, CallbackFuncPtr, FUNCFLAG_CDECL
+from pypy.rlib.libffi import ffi_type_void
 from pypy.module._rawffi.tracker import tracker
 from pypy.interpreter.error import OperationError
 from pypy.interpreter import gateway

Modified: pypy/branch/rawffi-64/pypy/module/_rawffi/test/test__rawffi.py
==============================================================================
--- pypy/branch/rawffi-64/pypy/module/_rawffi/test/test__rawffi.py	(original)
+++ pypy/branch/rawffi-64/pypy/module/_rawffi/test/test__rawffi.py	Sat Mar 20 20:16:14 2010
@@ -550,6 +550,22 @@
         a1.free()
         del cb
 
+    def test_void_returning_callback(self):
+        import _rawffi
+        lib = _rawffi.CDLL(self.lib_name)
+        runcallback = lib.ptr('runcallback', ['P'], None)
+        called = []
+        def callback():
+            called.append(True)
+
+        cb = _rawffi.CallbackPtr(callback, [], None)
+        a1 = cb.byptr()
+        res = runcallback(a1)
+        assert res is None
+        assert called == [True]
+        a1.free()
+        del cb
+
     def test_another_callback_in_stackless(self):
         try:
             import _stackless



More information about the Pypy-commit mailing list