mirror of
https://github.com/python/cpython.git
synced 2025-12-09 02:35:14 +00:00
Make AcquirerProxy.acquire() support timeout argument
This commit is contained in:
parent
b78174c010
commit
41eb85b194
1 changed files with 3 additions and 2 deletions
|
|
@ -957,8 +957,9 @@ class IteratorProxy(BaseProxy):
|
||||||
|
|
||||||
class AcquirerProxy(BaseProxy):
|
class AcquirerProxy(BaseProxy):
|
||||||
_exposed_ = ('acquire', 'release')
|
_exposed_ = ('acquire', 'release')
|
||||||
def acquire(self, blocking=True):
|
def acquire(self, blocking=True, timeout=None):
|
||||||
return self._callmethod('acquire', (blocking,))
|
args = (blocking,) if timeout is None else (blocking, timeout)
|
||||||
|
return self._callmethod('acquire', args)
|
||||||
def release(self):
|
def release(self):
|
||||||
return self._callmethod('release')
|
return self._callmethod('release')
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue