From: Stefan Behnel Date: Thu, 14 Apr 2011 16:37:34 +0000 (+0200) Subject: new test for auto_cpdef with closure functions X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d9d5ebb96c350658aa0172fbeaaf2c2229fa763b;p=cython.git new test for auto_cpdef with closure functions --- diff --git a/tests/bugs.txt b/tests/bugs.txt index 2aa611e0..2aeadbff 100644 --- a/tests/bugs.txt +++ b/tests/bugs.txt @@ -19,6 +19,7 @@ for_from_pyvar_loop_T601 decorators_T593 temp_sideeffects_T654 class_scope_T671 +auto_cpdef_closures # CPython regression tests that don't current work: pyregr.test_threadsignals diff --git a/tests/run/auto_cpdef_closures.py b/tests/run/auto_cpdef_closures.py new file mode 100644 index 00000000..68ad664b --- /dev/null +++ b/tests/run/auto_cpdef_closures.py @@ -0,0 +1,22 @@ +# cython: auto_cpdef=True +# mode:run +# tag: directive,auto_cpdef,closures + +def closure_func(x): + """ + >>> c = closure_func(2) + >>> c() + 2 + """ + def c(): + return x + return c + +def generator_func(): + """ + >>> for i in generator_func(): print(i) + 1 + 2 + """ + yield 1 + yield 2