From 112ad7fa2bb0d3d32c4a402c8e038875b444dd01 Mon Sep 17 00:00:00 2001
From: Mark Florisson <markflorisson88@gmail.com>
Date: Wed, 16 Mar 2011 12:58:29 +0100
Subject: [PATCH] Allow 'with cython.nogil:' statement

---
 Cython/Compiler/ParseTreeTransforms.py |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py
index 4d9d6da..0edb9bb 100644
--- a/Cython/Compiler/ParseTreeTransforms.py
+++ b/Cython/Compiler/ParseTreeTransforms.py
@@ -853,9 +853,9 @@ class InterpretCompilerDirectives(CythonTransform, SkipDeclarations):
                         PostParseError(node.pos, "Compiler directive with statements cannot contain 'as'"))
                 else:
                     name, value = directive
-                    if name == 'nogil':
+                    if name in ('nogil', 'gil'):
                         # 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)
                     if self.check_directive_scope(node.pos, name, 'with statement'):
                         directive_dict[name] = value
-- 
1.7.4.1

