Commit 778550c9 authored by Xavier Thompson's avatar Xavier Thompson

Prevent nested lock acquisition in operations and function calls

parent 98c42d7d
...@@ -512,6 +512,27 @@ class CypclassLockTransform(Visitor.EnvTransform): ...@@ -512,6 +512,27 @@ class CypclassLockTransform(Visitor.EnvTransform):
node.base = self.visit(node.base) node.base = self.visit(node.base)
return node return node
def visit_SimpleCallNode(self, node):
if node.type.is_error:
return node
for i, arg in enumerate(node.args or ()):
node.args[i] = self.visit_value(arg)
self.visitchildren(node, exclude=['args'])
return node
# Todo: other kinds of method calls
def visit_BinopNode(self, node):
node.operand1 = self.visit_value(node.operand1)
node.operand2 = self.visit_value(node.operand2)
return node
def visit_UnopNode(self, node):
node.operand = self.visit_value(node.operand)
return node
# Todo: other kinds of operations (comparisons, ...)
def visit_DelStatNode(self, node): def visit_DelStatNode(self, node):
for arg in node.args: for arg in node.args:
arg_entry = self.id(arg) arg_entry = self.id(arg)
......
...@@ -5935,7 +5935,8 @@ class SimpleCallNode(CallNode): ...@@ -5935,7 +5935,8 @@ class SimpleCallNode(CallNode):
# explicit_cpp_self bool used internally # explicit_cpp_self bool used internally
# needs_deref bool used internally # needs_deref bool used internally
subexprs = ['self', 'coerced_self', 'function', 'args', 'arg_tuple'] # evaluate arguments first.
subexprs = ['self', 'coerced_self', 'args', 'arg_tuple', 'function']
self = None self = None
coerced_self = None coerced_self = None
......
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