[pypy-commit] cffi win32-stdcall: check that the function types are really incompatible

arigo noreply at buildbot.pypy.org
Mon Oct 5 20:16:24 CEST 2015


Author: Armin Rigo <arigo at tunes.org>
Branch: win32-stdcall
Changeset: r2308:b3fc7b996d25
Date: 2015-10-05 20:17 +0200
http://bitbucket.org/cffi/cffi/changeset/b3fc7b996d25/

Log:	check that the function types are really incompatible

diff --git a/testing/cffi0/test_function.py b/testing/cffi0/test_function.py
--- a/testing/cffi0/test_function.py
+++ b/testing/cffi0/test_function.py
@@ -466,6 +466,13 @@
         tps = ffi.typeof("fns_t")
         assert str(tpc) == "<ctype 'int(*)(int)'>"
         assert str(tps) == "<ctype 'int(__stdcall *)(int)'>"
+        #
+        fnc = ffi.cast("fnc_t", 0)
+        fns = ffi.cast("fns_t", 0)
+        ffi.new("fnc_t[]", [fnc])
+        py.test.raises(TypeError, ffi.new, "fnc_t[]", [fns])
+        py.test.raises(TypeError, ffi.new, "fns_t[]", [fnc])
+        ffi.new("fns_t[]", [fns])
 
     def test_stdcall_only_on_windows(self):
         if sys.platform == 'win32':


More information about the pypy-commit mailing list