Fix broken error reporting for functions in pxds
authorDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Thu, 27 Nov 2008 16:54:26 +0000 (17:54 +0100)
committerDag Sverre Seljebotn <dagss@student.matnat.uio.no>
Thu, 27 Nov 2008 16:54:26 +0000 (17:54 +0100)
Cython/Compiler/ParseTreeTransforms.py
tests/errors/e_func_in_pxd.pyx [new file with mode: 0644]
tests/errors/e_func_in_pxd_support.pxd [new file with mode: 0644]

index 94689d6c2146434af168e5bb395197a7bf39325b..32669ff102b1358cd7a887c66e79eeb34909ef53 100644 (file)
@@ -239,7 +239,6 @@ class PxdPostParse(CythonTransform):
             ok = True
             for stat in node.body.stats:
                 if not isinstance(stat, CVarDefNode):
-                    self.context.error("C function definition not allowed here")
                     ok = False
                     break
             node = CVarDefNode(node.pos, 
diff --git a/tests/errors/e_func_in_pxd.pyx b/tests/errors/e_func_in_pxd.pyx
new file mode 100644 (file)
index 0000000..beef5a0
--- /dev/null
@@ -0,0 +1,5 @@
+cimport e_func_in_pxd_support
+
+_ERRORS = u"""
+1:5: function definition not allowed here
+"""
diff --git a/tests/errors/e_func_in_pxd_support.pxd b/tests/errors/e_func_in_pxd_support.pxd
new file mode 100644 (file)
index 0000000..001e070
--- /dev/null
@@ -0,0 +1,2 @@
+cdef foo():
+    return 1