From 1197cfa7b73aeab9f372dd3115adf6107b776c4d Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 13 Jan 2011 17:23:15 +0100 Subject: [PATCH] test that inferring the function pointer type for a C function is enabled in safe type inference mode --- tests/run/type_inference.pyx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/tests/run/type_inference.pyx b/tests/run/type_inference.pyx index a056fe34..2c5f1809 100644 --- a/tests/run/type_inference.pyx +++ b/tests/run/type_inference.pyx @@ -210,14 +210,14 @@ def builtin_type_methods(): append(1) assert l == [1], str(l) -cdef int func(int x): +cdef int cfunc(int x): return x+1 def c_functions(): """ >>> c_functions() """ - f = func + f = cfunc assert typeof(f) == 'int (*)(int)', typeof(f) assert 2 == f(1) @@ -424,6 +424,15 @@ def safe_only(): res = -j assert typeof(j) == "Python object", typeof(j) +@infer_types(None) +def safe_c_functions(): + """ + >>> safe_c_functions() + """ + f = cfunc + assert typeof(f) == 'int (*)(int)', typeof(f) + assert 2 == f(1) + @infer_types(None) def args_tuple_keywords(*args, **kwargs): """ -- 2.26.2