Commit e9e67551 authored by Mark Florisson's avatar Mark Florisson

Allow 'with cython.nogil:' statement

parent 7f141057
...@@ -946,9 +946,9 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations): ...@@ -946,9 +946,9 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
PostParseError(node.pos, "Compiler directive with statements cannot contain 'as'")) PostParseError(node.pos, "Compiler directive with statements cannot contain 'as'"))
else: else:
name, value = directive name, value = directive
if name == 'nogil': if name in ('nogil', 'gil'):
# special case: in pure mode, "with nogil" spells "with cython.nogil" # special case: in pure mode, "with nogil" spells "with cython.nogil"
node = Nodes.GILStatNode(node.pos, state = "nogil", body = node.body) node = Nodes.GILStatNode(node.pos, state = name, body = node.body)
return self.visit_Node(node) return self.visit_Node(node)
if self.check_directive_scope(node.pos, name, 'with statement'): if self.check_directive_scope(node.pos, name, 'with statement'):
directive_dict[name] = value directive_dict[name] = value
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment