fix error on def-nogil functions
authorStefan Behnel <scoder@users.berlios.de>
Sat, 1 May 2010 15:28:46 +0000 (17:28 +0200)
committerStefan Behnel <scoder@users.berlios.de>
Sat, 1 May 2010 15:28:46 +0000 (17:28 +0200)
Cython/Compiler/Parsing.py
tests/errors/def_nogil.pyx [new file with mode: 0644]

index ebee3bf79204375b0460850eea2e1a2852639ee4..13bf1a2102b7f40d0b7d9dbd1d250723ca3e8c0f 100644 (file)
@@ -2413,7 +2413,7 @@ def p_def_statement(s, decorators=None):
         starstar_arg = p_py_arg_decl(s)
     s.expect(')')
     if p_nogil(s):
-        error(s.pos, "Python function cannot be declared nogil")
+        error(pos, "Python function cannot be declared nogil")
     doc, body = p_suite(s, Ctx(level = 'function'), with_doc = 1)
     return Nodes.DefNode(pos, name = name, args = args, 
         star_arg = star_arg, starstar_arg = starstar_arg,
diff --git a/tests/errors/def_nogil.pyx b/tests/errors/def_nogil.pyx
new file mode 100644 (file)
index 0000000..85cf3c7
--- /dev/null
@@ -0,0 +1,7 @@
+
+def test() nogil:
+    pass
+
+_ERRORS = """
+2:0: Python function cannot be declared nogil
+"""