Commit 29cf967f authored by gsamain's avatar gsamain Committed by Xavier Thompson

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

parent c638057c
......@@ -8471,14 +8471,15 @@ class LockCypclassNode(StatNode):
is_rlocked = self.obj.is_rhs_locked(env)
is_wlocked = self.obj.is_lhs_locked(env)
if self.state == "unclocked" and not (is_rlocked or is_wlocked):
error(self.pos, "Cannot unlock an already unlocked object !")
if self.obj.type.lock_mode != "nolock":
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:
error(self.pos, "Double read lock !")
elif self.state == "rlocked" and is_rlocked:
error(self.pos, "Double read lock !")
elif self.state == "wlocked" and is_wlocked:
error(self.pos, "Double write lock !")
elif self.state == "wlocked" and is_wlocked:
error(self.pos, "Double write lock !")
# 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