Author: Antonio Cuni <[email protected]>
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:
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit