Commit baae5864 authored by Xavier Thompson's avatar Xavier Thompson

Fix cypclass lock analysis on function calls

parent 19ec8ac4
......@@ -704,9 +704,13 @@ class CypclassLockTransform(Visitor.EnvTransform):
return node
def visit_SimpleCallNode(self, node):
for i, arg in enumerate(node.args or ()): # provide an empty tuple fallback in case node.args is None
if arg.type.is_cyp_class:
node.args[i] = self.lockcheck_written_or_read(arg, reading=arg.type.is_const)
func_type = node.function_type()
if func_type.is_cfunction:
formal_nargs = len(func_type.args)
actual_nargs = len(node.args)
for i, formal_arg, actual_arg in zip(range(actual_nargs), func_type.args, node.args):
if formal_arg.type.is_cyp_class:
node.args[i] = self.lockcheck_written_or_read(actual_arg, reading=formal_arg.type.is_const)
with self.accesscontext(reading=True):
self.visitchildren(node)
return node
......
......@@ -31,5 +31,5 @@ _ERRORS = u"""
23:8: Reference 'obj' is not correctly locked in this expression (write lock required)
24:26: Reference 'obj' is not correctly locked in this expression (write lock required)
25:4: Reference 'obj' is not correctly locked in this expression (read lock required)
26:21: Reference 'obj' is not correctly locked in this expression (write lock required)
26:21: Reference 'obj' is not correctly locked in this expression (read lock required)
"""
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