diff options
Diffstat (limited to 'Lib/asyncio/locks.py')
-rw-r--r-- | Lib/asyncio/locks.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/asyncio/locks.py b/Lib/asyncio/locks.py index aa6ed3eaea..57eb69e7cf 100644 --- a/Lib/asyncio/locks.py +++ b/Lib/asyncio/locks.py @@ -3,6 +3,7 @@ __all__ = ['Lock', 'Event', 'Condition', 'Semaphore', 'BoundedSemaphore'] import collections +import warnings from . import events from . import futures @@ -63,6 +64,9 @@ class _ContextManagerMixin: # <block> # finally: # lock.release() + warnings.warn("'with (yield from lock)' is deprecated " + "use 'async with lock' instead", + DeprecationWarning, stacklevel=2) yield from self.acquire() return _ContextManager(self) @@ -71,6 +75,9 @@ class _ContextManagerMixin: return _ContextManager(self) def __await__(self): + warnings.warn("'with await lock' is deprecated " + "use 'async with lock' instead", + DeprecationWarning, stacklevel=2) # To make "with await lock" work. return self.__acquire_ctx().__await__() |