diff Lib/test/test_threading.py @ 68191:2ddca55e098d

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.
author Antoine Pitrou <solipsis@pitrou.net>
date Mon, 28 Feb 2011 22:03:34 +0000
parents f71acc4b2341
children b39270c6b8d1
line wrap: on
line diff
--- a/Lib/test/test_threading.py	Mon Feb 28 19:27:16 2011 +0000
+++ b/Lib/test/test_threading.py	Mon Feb 28 22:03:34 2011 +0000
@@ -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)