Test for #554, closures inside cdef block.
authorRobert Bradshaw <robertwb@math.washington.edu>
Wed, 7 Jul 2010 15:35:35 +0000 (08:35 -0700)
committerRobert Bradshaw <robertwb@math.washington.edu>
Wed, 7 Jul 2010 15:35:35 +0000 (08:35 -0700)
tests/bugs.txt
tests/run/closure_inside_cdef_T554.pyx [new file with mode: 0644]

index 5596f0f6dc56adc98679e11e29ea2852e1965a38..e7eac6805065dac4c356ea4edbf74232c5df5541 100644 (file)
@@ -13,6 +13,7 @@ cpp_templated_ctypedef
 cpp_structs
 genexpr_T491
 with_statement_module_level_T536
+closure_inside_cdef_T554
 
 # CPython regression tests that don't current work:
 pyregr.test_threadsignals
diff --git a/tests/run/closure_inside_cdef_T554.pyx b/tests/run/closure_inside_cdef_T554.pyx
new file mode 100644 (file)
index 0000000..1232c6b
--- /dev/null
@@ -0,0 +1,10 @@
+def call_f(x):
+    """
+    >>> call_f(2)
+    4
+    """
+    return f(x)
+
+cdef f(x):                # def  here => works fine
+   def g(y): return y*x  # cdef here => compile error
+   return g(x)           # faults@ INCREF(.*cur_scope->.*v_x