summaryrefslogtreecommitdiff
path: root/Cython/Compiler/ParseTreeTransforms.py
diff options
context:
space:
mode:
authorNoam Hershtig <noam@beeeye.co>2019-02-22 23:38:56 +0200
committerNoam Hershtig <noam@beeeye.co>2019-02-23 11:18:04 +0200
commit5ff75cdabb810221cbb656643e07031651a55757 (patch)
tree970a06e3df18375b5293b85559f73f430c9809b4 /Cython/Compiler/ParseTreeTransforms.py
parent605cc2143259e07ecd7df7aad79a37197fd011a2 (diff)
downloadcython-5ff75cdabb810221cbb656643e07031651a55757.tar.gz
Allow condition in GILStatNode
Diffstat (limited to 'Cython/Compiler/ParseTreeTransforms.py')
-rw-r--r--Cython/Compiler/ParseTreeTransforms.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/Cython/Compiler/ParseTreeTransforms.py b/Cython/Compiler/ParseTreeTransforms.py
index c3e3ff8ad..d1f9f598f 100644
--- a/Cython/Compiler/ParseTreeTransforms.py
+++ b/Cython/Compiler/ParseTreeTransforms.py
@@ -2915,6 +2915,11 @@ class GilCheck(VisitorTransform):
return node
def visit_GILStatNode(self, node):
+ if node.condition is not None:
+ error(node.pos, "Non-constant condition in a "
+ "`with %s(<condition>)` statement" % node.state)
+ return node
+
if self.nogil and node.nogil_check:
node.nogil_check()