1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48
|
# mode: error
# tag: werror
import cython
@cython.cfunc
@cython.exceptval(check=False)
def test_return_object_noexcept(x) -> object: # Err
return x
# declared in pxd as noexcept and cdef
def test_return_object_noexcept_in_pxd(x): # Err
return x
# declared in pxd as cdef
def test_return_object_in_pxd(x): # OK
return x
@cython.cfunc
@cython.exceptval(check=False)
def test_return_str_noexcept() -> str: # Err
return 'a'
@cython.cfunc
@cython.exceptval(check=False)
def test_noexcept(): # Err
pass
@cython.cfunc
def test_implicit_noexcept(): # Ok
pass
@cython.cfunc
def test_return_object(x) -> object: # Ok
return x
@cython.cfunc
def test_return_str() -> str: # Ok
return 'a'
_ERRORS = """
6:0: noexcept clause is ignored for function returning Python object
19:0: noexcept clause is ignored for function returning Python object
24:0: noexcept clause is ignored for function returning Python object
# from pxd
1:46: noexcept clause is ignored for function returning Python object
"""
|