From e4f6e4ca0800d36c4aac2bf24996b81c72865cce Mon Sep 17 00:00:00 2001 From: Lisandro Dalcin Date: Tue, 10 Feb 2009 11:17:08 -0200 Subject: [PATCH] extend tryfinally testcase --- tests/run/tryfinally.pyx | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/run/tryfinally.pyx b/tests/run/tryfinally.pyx index 871546d6..37a67bd6 100644 --- a/tests/run/tryfinally.pyx +++ b/tests/run/tryfinally.pyx @@ -29,6 +29,8 @@ TypeError 3 >>> try_continue(3) 3 +>>> try_return_none_1() +>>> try_return_none_2() """ def finally_except(): @@ -59,3 +61,25 @@ def try_continue(a): finally: i+=1 return i + + +def try_return_none_1(): + try: + return + finally: + return + +cdef extern from *: + ctypedef struct PyObject + void Py_INCREF(object) + +cdef PyObject* _none(): + ret = None + Py_INCREF(ret) + return ret + +def try_return_none_2(): + try: + return _none() + finally: + return _none() -- 2.26.2