Issue #11140: Lock.release() now raises a RuntimeError when attempting
to release an unacquired lock, as claimed in the threading documentation.
The _thread.error exception is now an alias of RuntimeError.
diff --git a/Lib/test/test_threading.py b/Lib/test/test_threading.py
index 13a428d..029218d 100644
--- a/Lib/test/test_threading.py
+++ b/Lib/test/test_threading.py
@@ -685,6 +685,10 @@
thread.start()
self.assertRaises(RuntimeError, setattr, thread, "daemon", True)
+ def test_releasing_unacquired_lock(self):
+ lock = threading.Lock()
+ self.assertRaises(RuntimeError, lock.release)
+
class LockTests(lock_tests.LockTests):
locktype = staticmethod(threading.Lock)