summaryrefslogtreecommitdiff
path: root/tests/run/legacy_implicit_noexcept_build.srctree
blob: c7b30693dbbf7facf7960a74f277cf0e1492aa3d (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
PYTHON setup.py build_ext --inplace
PYTHON -c "import bar"

######## setup.py ########

from Cython.Build.Dependencies import cythonize
from distutils.core import setup

setup(
  ext_modules = cythonize("*.pyx", compiler_directives={'legacy_implicit_noexcept': True}),
)


######## bar.pyx ########

cdef int func_noexcept() noexcept:
    raise RuntimeError()

cdef int func_implicit():
    raise RuntimeError()

cdef int func_return_value() except -1:
    raise RuntimeError()

func_noexcept()
func_implicit()

try:
    func_return_value()
except RuntimeError:
    pass
else:
    assert False, 'Exception not raised'