Author: Amaury Forgeot d'Arc <[email protected]>
Branch: py3k
Changeset: r58938:d1e40f463a3e
Date: 2012-11-16 00:26 +0100
http://bitbucket.org/pypy/pypy/changeset/d1e40f463a3e/

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

diff --git a/pypy/module/thread/os_lock.py b/pypy/module/thread/os_lock.py
--- a/pypy/module/thread/os_lock.py
+++ b/pypy/module/thread/os_lock.py
@@ -237,6 +237,7 @@
         """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):
diff --git a/pypy/module/thread/test/test_lock.py 
b/pypy/module/thread/test/test_lock.py
--- a/pypy/module/thread/test/test_lock.py
+++ b/pypy/module/thread/test/test_lock.py
@@ -109,6 +109,14 @@
         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()
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to