]> granicus.if.org Git - python/commitdiff
dummy_thread needs to support PEP 343 too.
authorPhillip J. Eby <pje@telecommunity.com>
Mon, 27 Mar 2006 23:32:10 +0000 (23:32 +0000)
committerPhillip J. Eby <pje@telecommunity.com>
Mon, 27 Mar 2006 23:32:10 +0000 (23:32 +0000)
Lib/dummy_thread.py

index fb3abbf75d0f2c0cf2093a823240eba39f2bc25e..d69d84053d841b5d9885c4e8b47c40f716ab125b 100644 (file)
@@ -113,6 +113,14 @@ class LockType(object):
             self.locked_status = True
             return True
 
+    __enter__ = acquire
+
+    def __exit__(self, typ, val, tb):
+        self.release()
+
+    def __context__(self):
+        return self
+
     def release(self):
         """Release the dummy lock."""
         # XXX Perhaps shouldn't actually bother to test?  Could lead