Author: Amaury Forgeot d'Arc <amaur...@gmail.com>
Branch: py3k
Changeset: r51467:fc8fcd7a4f56
Date: 2012-01-17 21:21 +0100
http://bitbucket.org/pypy/pypy/changeset/fc8fcd7a4f56/

Log:    Test and fix RLock context manager.

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
@@ -234,7 +234,7 @@
         self.acquire_w(space)
         return self
 
-    def descr__exit__(self, space, *args):
+    def descr__exit__(self, space, __args__):
         self.release_w(space)
 
 W_RLock.typedef = TypeDef(
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
@@ -122,3 +122,9 @@
         lock.release()
         assert lock._is_owned() is False
 
+    def test_context_manager(self):
+        import _thread
+        lock = _thread.RLock()
+        with lock:
+            assert lock._is_owned() is True
+
_______________________________________________
pypy-commit mailing list
pypy-commit@python.org
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to