4
cdef int raise_py_error() except *:
5
raise TypeError("custom")
7
cdef extern from "cpp_exceptions_helper.h":
8
cdef int raise_int_raw "raise_int"(bint fire) except +
9
cdef int raise_int_value "raise_int"(bint fire) except +ValueError
10
cdef int raise_int_custom "raise_int"(bint fire) except +raise_py_error
12
cdef int raise_index_raw "raise_index"(bint fire) except +
13
cdef int raise_index_value "raise_index"(bint fire) except +ValueError
14
cdef int raise_index_custom "raise_index"(bint fire) except +raise_py_error
16
cdef void raise_domain_error() except +
17
cdef void raise_ios_failure() except +
18
cdef void raise_memory() except +
19
cdef void raise_overflow() except +
20
cdef void raise_range_error() except +
21
cdef void raise_typeerror() except +
22
cdef void raise_underflow() except +
24
cdef raise_or_throw(bint py) except +
25
cdef int raise_or_throw_int(bint py) except +*
28
int bar_raw "bar"(bint fire) except +
29
int bar_value "bar"(bint fire) except +ValueError
30
int bar_custom "bar"(bint fire) except +raise_py_error
33
def test_domain_error():
35
>>> test_domain_error()
36
Traceback (most recent call last):
38
ValueError: domain_error
42
def test_ios_failure():
44
>>> try: test_ios_failure()
45
... except (IOError, OSError): pass
52
Traceback (most recent call last):
56
# Re-raise the exception without a description string because we can't
57
# rely on the implementation-defined value of what() in the doctest.
66
Traceback (most recent call last):
68
OverflowError: overflow_error
72
def test_range_error():
74
>>> test_range_error()
75
Traceback (most recent call last):
77
ArithmeticError: range_error
84
Traceback (most recent call last):
88
# Re-raise the exception without a description string because we can't
89
# rely on the implementation-defined value of what() in the doctest.
98
Traceback (most recent call last):
100
ArithmeticError: underflow_error
104
def test_func_that_can_raise_or_throw(bint py):
106
>>> test_func_that_can_raise_or_throw(0)
107
Traceback (most recent call last):
110
>>> test_func_that_can_raise_or_throw(1)
111
Traceback (most recent call last):
117
def test_func_that_can_raise_or_throw_c_return(bint py):
119
>>> test_func_that_can_raise_or_throw_c_return(0)
120
Traceback (most recent call last):
123
>>> test_func_that_can_raise_or_throw_c_return(1)
124
Traceback (most recent call last):
128
raise_or_throw_int(py)
130
def test_int_raw(bint fire):
132
>>> test_int_raw(False)
133
>>> test_int_raw(True)
134
Traceback (most recent call last):
136
RuntimeError: Unknown exception
140
def test_int_value(bint fire):
142
>>> test_int_value(False)
143
>>> test_int_value(True)
144
Traceback (most recent call last):
148
raise_int_value(fire)
150
def test_int_custom(bint fire):
152
>>> test_int_custom(False)
153
>>> test_int_custom(True)
154
Traceback (most recent call last):
158
raise_int_custom(fire)
160
def test_index_raw(bint fire):
162
>>> test_index_raw(False)
163
>>> test_index_raw(True)
164
Traceback (most recent call last):
166
IndexError: c++ error
168
raise_index_raw(fire)
170
def test_index_value(bint fire):
172
>>> test_index_value(False)
173
>>> test_index_value(True)
174
Traceback (most recent call last):
176
ValueError: c++ error
178
raise_index_value(fire)
180
def test_index_custom(bint fire):
182
>>> test_index_custom(False)
183
>>> test_index_custom(True)
184
Traceback (most recent call last):
188
raise_index_custom(fire)
190
def test_cppclass_method_raw(bint fire):
192
>>> test_cppclass_method_raw(False)
193
>>> test_cppclass_method_raw(True)
194
Traceback (most recent call last):
196
RuntimeError: Unknown exception
204
def test_cppclass_method_value(bint fire):
206
>>> test_cppclass_method_value(False)
207
>>> test_cppclass_method_value(True)
208
Traceback (most recent call last):
218
def test_cppclass_method_custom(bint fire):
220
>>> test_cppclass_method_custom(False)
221
>>> test_cppclass_method_custom(True)
222
Traceback (most recent call last):