Commit 0ef0a005 authored by Stefan Behnel's avatar Stefan Behnel

add test for cfunc auto-wrapping at module level

parent 63a5d786
# mode: run # mode: run
# cython: always_allow_keywords=True # cython: always_allow_keywords=True
cimport cython
from libc.math cimport sqrt from libc.math cimport sqrt
...@@ -56,6 +57,22 @@ def return_libc_sqrt(): ...@@ -56,6 +57,22 @@ def return_libc_sqrt():
return sqrt return sqrt
global_csqrt = sqrt
def test_global():
"""
>>> global_csqrt(9)
3.0
>>> global_csqrt.__doc__
'wrap(x: float) -> float'
>>> test_global()
double (double) nogil
Python object
"""
print cython.typeof(sqrt)
print cython.typeof(global_csqrt)
cdef long long rad(long long x): cdef long long rad(long long x):
cdef long long rad = 1 cdef long long rad = 1
for p in range(2, <long long>sqrt(x) + 1): for p in range(2, <long long>sqrt(x) + 1):
......
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