From 8f56d02309a71254e7b32e4dfd3669399bcd3fc2 Mon Sep 17 00:00:00 2001 From: Guido van Rossum Date: Tue, 25 Apr 2006 20:12:45 +0000 Subject: Implement MvL's improvement on __context__ in Condition; this can just call __context__ on the underlying lock. (The same change for Semaphore does *not* work!) --- Lib/threading.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/Lib/threading.py b/Lib/threading.py index cc1adce..27ec6b4 100644 --- a/Lib/threading.py +++ b/Lib/threading.py @@ -164,7 +164,6 @@ class _Condition(_Verbose): self.__lock = lock # Export the lock's acquire() and release() methods self.acquire = lock.acquire - self.__enter__ = self.acquire self.release = lock.release # If the lock defines _release_save() and/or _acquire_restore(), # these override the default implementations (which just call @@ -184,10 +183,7 @@ class _Condition(_Verbose): self.__waiters = [] def __context__(self): - return self - - def __exit__(self, t, v, tb): - self.release() + return self.__lock.__context__() def __repr__(self): return "" % (self.__lock, len(self.__waiters)) -- cgit v0.12