diff options
author | Phillip J. Eby <pje@telecommunity.com> | 2006-03-27 23:32:10 (GMT) |
---|---|---|
committer | Phillip J. Eby <pje@telecommunity.com> | 2006-03-27 23:32:10 (GMT) |
commit | 849974fb560e6d7d508b9fc2eaf45f070dd72062 (patch) | |
tree | 27f024b004532c4153f19b086920710d782f93e4 /Lib/dummy_thread.py | |
parent | b6e92c40a97c3bd6ec6420cdd0d21c1d7ef45817 (diff) | |
download | cpython-849974fb560e6d7d508b9fc2eaf45f070dd72062.zip cpython-849974fb560e6d7d508b9fc2eaf45f070dd72062.tar.gz cpython-849974fb560e6d7d508b9fc2eaf45f070dd72062.tar.bz2 |
dummy_thread needs to support PEP 343 too.
Diffstat (limited to 'Lib/dummy_thread.py')
-rw-r--r-- | Lib/dummy_thread.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/dummy_thread.py b/Lib/dummy_thread.py index fb3abbf..d69d840 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 |