mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
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.
This commit is contained in:
parent
cfbcec3823
commit
fcf81fd031
4 changed files with 14 additions and 1 deletions
|
@ -685,6 +685,10 @@ class ThreadingExceptionTests(BaseTestCase):
|
|||
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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue