Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix test
  • Loading branch information
asvetlov committed Dec 9, 2017
commit c57bccb997022a1d1cbcd738344cd58c3b8e3b31
7 changes: 5 additions & 2 deletions Lib/asyncio/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ def __iter__(self):
# <block>
# finally:
# lock.release()
warnings.warn("'with (yield from lock):' is deprecated "
"use 'async with lock:' instead",
warnings.warn("'with (yield from lock)' is deprecated "
"use 'async with lock' instead",
DeprecationWarning, stacklevel=2)
yield from self.acquire()
return _ContextManager(self)
Expand All @@ -75,6 +75,9 @@ async def __acquire_ctx(self):
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__()

Expand Down