From 69fb3b5feb3038eaa4d96933bfdb1ace6c2d23b0 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Fri, 6 Jun 2008 08:31:11 +0200 Subject: [PATCH] test case for exception propagation across functions --- tests/run/exceptionpropagation.pyx | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/run/exceptionpropagation.pyx 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) -- 2.26.2