File: w_noexcept.pyx

package info (click to toggle)
cython 3.0.11%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 19,092 kB
  • sloc: python: 83,539; ansic: 18,831; cpp: 1,402; xml: 1,031; javascript: 511; makefile: 403; sh: 204; sed: 11
file content (78 lines) | stat: -rw-r--r-- 1,743 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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
# mode: error
# tag: werror

import cython

ctypedef fused double_or_object:
    double
    object

cdef object test_return_object_noexcept(x) noexcept: # Err
    return x

cdef str test_return_str_noexcept() noexcept: # Err
    return 'a'

cdef test_noexcept() noexcept:  # Err
    pass

cdef test_implicit_noexcept(): # Ok
    pass

cdef object test_return_object(x): # Ok
    return x

cdef str test_return_str(): # Ok
    return 'a'

cdef extern from *:
    cdef object extern_return_object(): # Ok
        pass

    cdef object extern_noexcept() noexcept: # Ok
        pass

cdef double_or_object test_fused_noexcept(double_or_object x) noexcept: # Ok
    pass

@cython.exceptval(check=False)
@cython.cfunc
def test_pure_noexcept(): # Err
    pass

@cython.exceptval(check=False)
@cython.cfunc
def test_pure_return_object_noexcept() -> object: # Err
    pass

@cython.exceptval(check=False)
@cython.cfunc
def test_pure_return_str_noexcept() -> str: # Err
    pass

@cython.cfunc
def test_pure_implicit(): # Ok
    pass

@cython.cfunc
def test_pure_return_object() -> object: # Ok
    pass

@cython.cfunc
def test_pure_return_str() -> str: # Ok
    pass

@cython.exceptval(check=False)
@cython.cfunc
def test_pure_return_fused_noexcept(x: double_or_object) -> double_or_object: # Ok
    return x


_ERRORS = """
10:39: noexcept clause is ignored for function returning Python object
13:33: noexcept clause is ignored for function returning Python object
16:18: noexcept clause is ignored for function returning Python object
38:0: noexcept clause is ignored for function returning Python object
43:0: noexcept clause is ignored for function returning Python object
48:0: noexcept clause is ignored for function returning Python object
"""