From ff9c18d513e9d1d4adcd68306dfa3052bae510cc Mon Sep 17 00:00:00 2001 From: Stefan Behnel Date: Sat, 1 May 2010 17:28:46 +0200 Subject: [PATCH] fix error on def-nogil functions --- Cython/Compiler/Parsing.py | 2 +- tests/errors/def_nogil.pyx | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 tests/errors/def_nogil.pyx 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 +""" -- 2.26.2