new test for auto_cpdef with closure functions
authorStefan Behnel <scoder@users.berlios.de>
Thu, 14 Apr 2011 16:37:34 +0000 (18:37 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Thu, 14 Apr 2011 16:37:34 +0000 (18:37 +0200)
tests/bugs.txt
tests/run/auto_cpdef_closures.py [new file with mode: 0644]

index 2aa611e0b99fe1bdc571e93b19d53670675f6997..2aeadbff8802b5b7106264544bbf67e1d0e31503 100644 (file)
@@ -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 (file)
index 0000000..68ad664
--- /dev/null
@@ -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