Author: Armin Rigo <ar...@tunes.org> Branch: Changeset: r872:b3678ddd1d27 Date: 2012-08-22 19:50 +0200 http://bitbucket.org/cffi/cffi/changeset/b3678ddd1d27/
Log: Test and fix: don't allow 'void' as the type of a function argument. diff --git a/c/_cffi_backend.c b/c/_cffi_backend.c --- a/c/_cffi_backend.c +++ b/c/_cffi_backend.c @@ -3184,7 +3184,7 @@ else if (ct->ct_flags & (CT_POINTER|CT_ARRAY|CT_FUNCTIONPTR)) { return &ffi_type_pointer; } - else if (ct->ct_flags & CT_VOID) { + else if ((ct->ct_flags & CT_VOID) && is_result_type) { return &ffi_type_void; } diff --git a/c/test_c.py b/c/test_c.py --- a/c/test_c.py +++ b/c/test_c.py @@ -773,6 +773,11 @@ BFunc = new_function_type((BInt, BInt), BVoid, False) assert repr(BFunc) == "<ctype 'void(*)(int, int)'>" +def test_function_void_arg(): + BVoid = new_void_type() + BInt = new_primitive_type("int") + py.test.raises(TypeError, new_function_type, (BVoid,), BInt, False) + def test_call_function_0(): BSignedChar = new_primitive_type("signed char") BFunc0 = new_function_type((BSignedChar, BSignedChar), BSignedChar, False) _______________________________________________ pypy-commit mailing list pypy-commit@python.org http://mail.python.org/mailman/listinfo/pypy-commit