Skip to content

Commit f40c3d4

Browse files
committed
Fix thread.rs
1 parent 437a819 commit f40c3d4

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

vm/src/stdlib/thread.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ impl PyLock {
122122
#[pymethod]
123123
#[pymethod(name = "release_lock")]
124124
fn release(&self, vm: &VirtualMachine) -> PyResult<()> {
125-
if self.mu.is_locked() {
125+
if !self.mu.is_locked() {
126126
return Err(vm.new_runtime_error("release unlocked lock".to_owned()));
127127
}
128128
unsafe { self.mu.unlock() };
@@ -183,7 +183,7 @@ impl PyRLock {
183183
#[pymethod]
184184
#[pymethod(name = "release_lock")]
185185
fn release(&self, vm: &VirtualMachine) -> PyResult<()> {
186-
if self.mu.is_locked() {
186+
if !self.mu.is_locked() {
187187
return Err(vm.new_runtime_error("release unlocked lock".to_owned()));
188188
}
189189
unsafe { self.mu.unlock() };

0 commit comments

Comments
 (0)