mirror of
https://github.com/python/cpython.git
synced 2025-11-18 18:31:56 +00:00
Get rid of __context__, per the latest changes to PEP 343 and python-dev
discussion. There are two places of documentation that still mention __context__: Doc/lib/libstdtypes.tex -- I wasn't quite sure how to rewrite that without spending a whole lot of time thinking about it; and whatsnew, which Andrew usually likes to change himself.
This commit is contained in:
parent
8f6cbe1502
commit
da5b701aee
15 changed files with 27 additions and 202 deletions
|
|
@ -90,9 +90,6 @@ class _RLock(_Verbose):
|
|||
self.__owner and self.__owner.getName(),
|
||||
self.__count)
|
||||
|
||||
def __context__(self):
|
||||
return self
|
||||
|
||||
def acquire(self, blocking=1):
|
||||
me = currentThread()
|
||||
if self.__owner is me:
|
||||
|
|
@ -182,8 +179,11 @@ class _Condition(_Verbose):
|
|||
pass
|
||||
self.__waiters = []
|
||||
|
||||
def __context__(self):
|
||||
return self.__lock.__context__()
|
||||
def __enter__(self):
|
||||
return self.__lock.__enter__()
|
||||
|
||||
def __exit__(self, *args):
|
||||
return self.__lock.__exit__(*args)
|
||||
|
||||
def __repr__(self):
|
||||
return "<Condition(%s, %d)>" % (self.__lock, len(self.__waiters))
|
||||
|
|
@ -278,9 +278,6 @@ class _Semaphore(_Verbose):
|
|||
self.__cond = Condition(Lock())
|
||||
self.__value = value
|
||||
|
||||
def __context__(self):
|
||||
return self
|
||||
|
||||
def acquire(self, blocking=1):
|
||||
rc = False
|
||||
self.__cond.acquire()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue