From: Stefan Behnel Date: Sat, 1 May 2010 15:28:46 +0000 (+0200) Subject: fix error on def-nogil functions X-Git-Tag: 0.13.beta0~122 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=ff9c18d513e9d1d4adcd68306dfa3052bae510cc;p=cython.git fix error on def-nogil functions --- diff --git a/Cython/Compiler/Parsing.py b/Cython/Compiler/Parsing.py index ebee3bf7..13bf1a21 100644 --- a/Cython/Compiler/Parsing.py +++ b/Cython/Compiler/Parsing.py @@ -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 index 00000000..85cf3c73 --- /dev/null +++ b/tests/errors/def_nogil.pyx @@ -0,0 +1,7 @@ + +def test() nogil: + pass + +_ERRORS = """ +2:0: Python function cannot be declared nogil +"""