summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorAntoine Pitrou <solipsis@pitrou.net>2011-03-30 23:03:10 (GMT)
committerAntoine Pitrou <solipsis@pitrou.net>2011-03-30 23:03:10 (GMT)
commitd85456279f129e19a3f4c8ba0b3d05f5bdbfca1d (patch)
treeb6dba00c7a9e08d4dcb12a96106186df8debd48c /Lib
parent3c136e19b9de13f8d4163a0feb3af54ab8b8c765 (diff)
parent7899acfc23c6262cea8f69bda36cf256cdfc3501 (diff)
downloadcpython-d85456279f129e19a3f4c8ba0b3d05f5bdbfca1d.zip
cpython-d85456279f129e19a3f4c8ba0b3d05f5bdbfca1d.tar.gz
cpython-d85456279f129e19a3f4c8ba0b3d05f5bdbfca1d.tar.bz2
Issue #11618: Fix the timeout logic in threading.Lock.acquire() under
Windows.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/lock_tests.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/lock_tests.py b/Lib/test/lock_tests.py
index b6d818e..005c912 100644
--- a/Lib/test/lock_tests.py
+++ b/Lib/test/lock_tests.py
@@ -213,6 +213,16 @@ class LockTests(BaseLockTests):
lock.acquire()
lock.release()
+ def test_state_after_timeout(self):
+ # Issue #11618: check that lock is in a proper state after a
+ # (non-zero) timeout.
+ lock = self.locktype()
+ lock.acquire()
+ self.assertFalse(lock.acquire(timeout=0.01))
+ lock.release()
+ self.assertFalse(lock.locked())
+ self.assertTrue(lock.acquire(blocking=False))
+
class RLockTests(BaseLockTests):
"""