From d9d5ebb96c350658aa0172fbeaaf2c2229fa763b Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Thu, 14 Apr 2011 18:37:34 +0200 Subject: [PATCH] new test for auto_cpdef with closure functions --- tests/bugs.txt | 1 + tests/run/auto_cpdef_closures.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 tests/run/auto_cpdef_closures.py 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 -- 2.26.2