blob: 2c79bf26e705a4411099a0958a2cccdb9295506a (
plain)
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
|
cdef int CHKERR(int ierr) except -1:
if ierr==0: return 0
raise RuntimeError
cdef int obj2int(object ob) except *:
return ob
def foo(a):
"""
>>> foo(0)
>>> foo(1)
Traceback (most recent call last):
RuntimeError
"""
cdef int i = obj2int(a)
CHKERR(i)
cdef int* except_expr(bint fire) except <int*>-1:
if fire:
raise RuntimeError
def test_except_expr(bint fire):
"""
>>> test_except_expr(False)
>>> test_except_expr(True)
Traceback (most recent call last):
...
RuntimeError
"""
except_expr(fire)
cdef double except_big_result(bint fire) except 100000000000000000000000000000000:
if fire:
raise RuntimeError
def test_except_big_result(bint fire):
"""
>>> test_except_big_result(False)
>>> test_except_big_result(True)
Traceback (most recent call last):
...
RuntimeError
"""
except_big_result(fire)
cdef unsigned short except_promotion_compare(bint fire) except *:
if fire:
raise RuntimeError
def test_except_promotion_compare(bint fire):
"""
>>> test_except_promotion_compare(False)
>>> test_except_promotion_compare(True)
Traceback (most recent call last):
...
RuntimeError
"""
except_promotion_compare(fire)
|