From: Stefan Behnel Date: Fri, 6 Jun 2008 06:31:11 +0000 (+0200) Subject: test case for exception propagation across functions X-Git-Tag: 0.9.8rc1~11^2~10^2~6^2~8 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=69fb3b5feb3038eaa4d96933bfdb1ace6c2d23b0;p=cython.git test case for exception propagation across functions --- diff --git a/tests/run/exceptionpropagation.pyx b/tests/run/exceptionpropagation.pyx new file mode 100644 index 00000000..e324a70a --- /dev/null +++ b/tests/run/exceptionpropagation.pyx @@ -0,0 +1,17 @@ +__doc__ = u""" +>>> foo(0) +>>> foo(1) +Traceback (most recent call last): +RuntimeError +""" + +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): + cdef int i = obj2int(a) + CHKERR(i)