summaryrefslogtreecommitdiff
path: root/tests/run/cpp_exception_declaration_compatibility.srctree
blob: 775761c236b437b10cfbdae8a013d7633bc9dab8 (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
# tag: cpp

"""
PYTHON setup.py build_ext -i
PYTHON test.py
"""

############### setup.py ###################
from distutils.core import setup
from Cython.Build import cythonize

setup(
    name="cython_test",
    ext_modules=cythonize('*.pyx', language="c++")
)


############### test.py ###################

from cpp_exc import TestClass

TestClass().test_func()


############### cpp_exc.pxd ###################

cdef inline void handle_exception():
    pass

cdef class TestClass:
    cpdef test_func(self) except +handle_exception


############### cpp_exc.pyx ###################

cdef class TestClass:
    cpdef test_func(self) except +handle_exception:
        print('test')