Commit 4297ecbf authored by gsamain's avatar gsamain Committed by Xavier Thompson

With lock statement silently accept perceived inconsistent lock states for nolock cyobjects

parent 3bb8b9e5
...@@ -8438,14 +8438,15 @@ class LockCypclassNode(StatNode): ...@@ -8438,14 +8438,15 @@ class LockCypclassNode(StatNode):
is_rlocked = self.obj.is_rhs_locked(env) is_rlocked = self.obj.is_rhs_locked(env)
is_wlocked = self.obj.is_lhs_locked(env) is_wlocked = self.obj.is_lhs_locked(env)
if self.state == "unclocked" and not (is_rlocked or is_wlocked): if self.obj.type.lock_mode != "nolock":
error(self.pos, "Cannot unlock an already unlocked object !") if self.state == "unclocked" and not (is_rlocked or is_wlocked):
error(self.pos, "Cannot unlock an already unlocked object !")
elif self.state == "rlocked" and is_rlocked: elif self.state == "rlocked" and is_rlocked:
error(self.pos, "Double read lock !") error(self.pos, "Double read lock !")
elif self.state == "wlocked" and is_wlocked: elif self.state == "wlocked" and is_wlocked:
error(self.pos, "Double write lock !") error(self.pos, "Double write lock !")
# We need to save states because in case of 'with unlocked' statement, # We need to save states because in case of 'with unlocked' statement,
......
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