Commit 1197cfa7 authored by Stefan Behnel's avatar Stefan Behnel

test that inferring the function pointer type for a C function is enabled in...

test that inferring the function pointer type for a C function is enabled in safe type inference mode
parent d8207c2b
...@@ -210,14 +210,14 @@ def builtin_type_methods(): ...@@ -210,14 +210,14 @@ def builtin_type_methods():
append(1) append(1)
assert l == [1], str(l) assert l == [1], str(l)
cdef int func(int x): cdef int cfunc(int x):
return x+1 return x+1
def c_functions(): def c_functions():
""" """
>>> c_functions() >>> c_functions()
""" """
f = func f = cfunc
assert typeof(f) == 'int (*)(int)', typeof(f) assert typeof(f) == 'int (*)(int)', typeof(f)
assert 2 == f(1) assert 2 == f(1)
...@@ -424,6 +424,15 @@ def safe_only(): ...@@ -424,6 +424,15 @@ def safe_only():
res = -j res = -j
assert typeof(j) == "Python object", typeof(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) @infer_types(None)
def args_tuple_keywords(*args, **kwargs): def args_tuple_keywords(*args, **kwargs):
""" """
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment