From 8f516cc5758d04cf96932726f84cec4bada85739 Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 25 Nov 2010 15:32:22 +0100 Subject: [PATCH] additional closure tests --- tests/run/closures_T82.pyx | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/tests/run/closures_T82.pyx b/tests/run/closures_T82.pyx index de634856..cb7f9c1c 100644 --- a/tests/run/closures_T82.pyx +++ b/tests/run/closures_T82.pyx @@ -184,3 +184,31 @@ def more_inner_funcs(x): # called with (2,4,8) return f(a_f), g(b_g), h(b_h) return resolve + +def deep_inner(): + """ + >>> deep_inner()() + 2 + """ + cdef int x = 1 + def f(): + def g(): + def h(): + return x+1 + return h + return g() + return f() + +def deep_inner_sibling(): + """ + >>> deep_inner_sibling()() + 2 + """ + cdef int x = 1 + def f(): + def g(): + return x+1 + def h(): + return g() + return h + return f() -- 2.26.2