Commits

Amaury Forgeot d'Arc  committed d1e40f4

Add basic tests for RLock._release_save(),
and probably fix the deadlock in test_threading.

  • Participants
  • Parent commits 51190b9
  • Branches py3k

Comments (0)

Files changed (2)

File pypy/module/thread/os_lock.py

         """For internal use by `threading.Condition`."""
         count, self.rlock_count = self.rlock_count, 0
         owner, self.rlock_owner = self.rlock_owner, 0
+        self.lock.release()
         return space.newtuple([space.wrap(count), space.wrap(owner)])
 
     def descr__enter__(self, space):

File pypy/module/thread/test/test_lock.py

         lock.release()
         raises(RuntimeError, lock.release)
 
+    def test_release_save(self):
+        import _thread
+        lock = _thread.RLock()
+        lock.acquire()
+        state = lock._release_save()
+        lock._acquire_restore(state)
+        lock.release()
+
     def test__is_owned(self):
         import _thread
         lock = _thread.RLock()