[Python-checkins] r45718 - python/trunk/Lib/threading.py
guido.van.rossum
python-checkins at python.org
Tue Apr 25 22:12:45 CEST 2006
Author: guido.van.rossum
Date: Tue Apr 25 22:12:45 2006
New Revision: 45718
Modified:
python/trunk/Lib/threading.py
Log:
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!)
Modified: python/trunk/Lib/threading.py
==============================================================================
--- python/trunk/Lib/threading.py (original)
+++ python/trunk/Lib/threading.py Tue Apr 25 22:12:45 2006
@@ -164,7 +164,6 @@
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 @@
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))
More information about the Python-checkins
mailing list