[pypy-commit] pypy default: this makes all these tests failing, because pypy does not correctly unwrap the parameters before passing them to the callbacks

antocuni noreply at buildbot.pypy.org
Wed Jul 27 13:24:19 CEST 2011


Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: 
Changeset: r46006:157edf3b2ce8
Date: 2011-07-27 10:43 +0200
http://bitbucket.org/pypy/pypy/changeset/157edf3b2ce8/

Log:	this makes all these tests failing, because pypy does not correctly
	unwrap the parameters before passing them to the callbacks

diff --git a/pypy/module/test_lib_pypy/ctypes_tests/test_callbacks.py b/pypy/module/test_lib_pypy/ctypes_tests/test_callbacks.py
--- a/pypy/module/test_lib_pypy/ctypes_tests/test_callbacks.py
+++ b/pypy/module/test_lib_pypy/ctypes_tests/test_callbacks.py
@@ -14,14 +14,27 @@
         return args[-1]
 
     def check_type(self, typ, arg):
+        unwrapped_types = {
+            c_float: float,
+            c_double: float,
+            c_char: str,
+            c_char_p: str,
+            c_uint: long,
+            c_ulong: long,
+            }
+        
         PROTO = self.functype.im_func(typ, typ)
-        result = PROTO(self.callback)(arg)
+        cfunc = PROTO(self.callback)
+        result = cfunc(arg)
         if typ == c_float:
             assert abs(result - arg) < 0.000001
         else:
             assert self.got_args == (arg,)
             assert result == arg
 
+        result2 = cfunc(typ(arg))
+        assert type(result2) is unwrapped_types.get(typ, int)
+
         PROTO = self.functype.im_func(typ, c_byte, typ)
         result = PROTO(self.callback)(-3, arg)
         if typ == c_float:


More information about the pypy-commit mailing list