From 55ac39ee5987a681b07a5b9ade320f221f37be61 Mon Sep 17 00:00:00 2001
From: Dag Sverre Seljebotn <dagss@student.matnat.uio.no>
Date: Thu, 27 Nov 2008 17:54:26 +0100
Subject: [PATCH] Fix broken error reporting for functions in pxds

---
 Cython/Compiler/ParseTreeTransforms.py | 1 -
 tests/errors/e_func_in_pxd.pyx         | 5 +++++
 tests/errors/e_func_in_pxd_support.pxd | 2 ++
 3 files changed, 7 insertions(+), 1 deletion(-)
 create mode 100644 tests/errors/e_func_in_pxd.pyx
 create mode 100644 tests/errors/e_func_in_pxd_support.pxd

diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py
index 94689d6c2..32669ff10 100644
--- a/Cython/Compiler/ParseTreeTransforms.py
+++ b/Cython/Compiler/ParseTreeTransforms.py
@@ -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
index 000000000..beef5a0ec
--- /dev/null
+++ b/tests/errors/e_func_in_pxd.pyx
@@ -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
index 000000000..001e07017
--- /dev/null
+++ b/tests/errors/e_func_in_pxd_support.pxd
@@ -0,0 +1,2 @@
+cdef foo():
+    return 1
-- 
2.30.9