[pypy-commit] pypy py3k: Add basic tests for RLock._release_save(),
amauryfa
noreply at buildbot.pypy.org
Fri Nov 16 00:27:42 CET 2012
Author: Amaury Forgeot d'Arc <amauryfa at gmail.com>
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()
More information about the pypy-commit
mailing list