summaryrefslogtreecommitdiffstats
path: root/Lib/threading.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2006-04-25 20:12:45 (GMT)
committerGuido van Rossum <guido@python.org>2006-04-25 20:12:45 (GMT)
commit8f56d02309a71254e7b32e4dfd3669399bcd3fc2 (patch)
tree9e4aaa90d4cda132c95f3bde2d6937e426eab3bf /Lib/threading.py
parent4e1777de63db3ed2c397fc6838b08e921d60b93d (diff)
downloadcpython-8f56d02309a71254e7b32e4dfd3669399bcd3fc2.zip
cpython-8f56d02309a71254e7b32e4dfd3669399bcd3fc2.tar.gz
cpython-8f56d02309a71254e7b32e4dfd3669399bcd3fc2.tar.bz2
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!)
Diffstat (limited to 'Lib/threading.py')
-rw-r--r--Lib/threading.py6
1 files changed, 1 insertions, 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 "<Condition(%s, %d)>" % (self.__lock, len(self.__waiters))