From: Phillip J. Eby Date: Mon, 27 Mar 2006 23:32:10 +0000 (+0000) Subject: dummy_thread needs to support PEP 343 too. X-Git-Tag: v2.5a0~60 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=849974fb560e6d7d508b9fc2eaf45f070dd72062;p=python dummy_thread needs to support PEP 343 too. --- diff --git a/Lib/dummy_thread.py b/Lib/dummy_thread.py index fb3abbf75d..d69d84053d 100644 --- a/Lib/dummy_thread.py +++ b/Lib/dummy_thread.py @@ -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