File: w_noexcept_pure.py

package info (click to toggle)
cython 3.1.6%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 19,932 kB
  • sloc: python: 92,172; ansic: 19,275; cpp: 1,407; xml: 1,031; javascript: 511; makefile: 373; sh: 223; sed: 11
file content (48 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download
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
"""