Commit 62205a58 authored by Xavier Thompson's avatar Xavier Thompson

Fix cypclass locking logic

parent d1401b1e
......@@ -425,16 +425,13 @@ class CypclassLockTransform(Visitor.EnvTransform):
# that the receiver object will only be read, not that
# __all__ the reachable subobjects will only be read.
locally_writing = (field_access and node.is_target) or method_call
writing = self.writing | locally_writing
if objtype.is_qualified_cyp_class and objtype.qualifier == 'lock':
old_writing = self.writing
self.writing = locally_writing
self.writing = False
self.visitchildren(node)
if field_access or (method_call and not nodetype.self_qualifier == 'lock'):
node.obj = ExprNodes.CoerceToLockedNode(node.obj, exclusive=self.writing)
self.writing = old_writing
elif objtype.is_cyp_class:
old_writing = self.writing
self.writing |= locally_writing
node.obj = ExprNodes.CoerceToLockedNode(node.obj, exclusive=writing)
else:
self.writing = writing
self.visitchildren(node)
self.writing = old_writing
return node
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