bpo-36921: Deprecate @coroutine and yield from in asyncio#13334
bpo-36921: Deprecate @coroutine and yield from in asyncio#13334asvetlov wants to merge 10 commits intopython:masterfrom
Conversation
| return f'<{self.__class__.__name__} {coro_repr}>' | ||
|
|
||
| def __iter__(self): | ||
| warnings.warn("yield from coro is deprecated, please use await coro instead", |
There was a problem hiding this comment.
Maybe use coroutine instead of the coro because I think coro is not defined in the glossary.
yield from coroutine
await coroutine
There was a problem hiding this comment.
Maybe.
On the other hand, I don't like too long messages.
Usually, I rely on @1st1 judgment for texts :)
|
|
||
| __iter__ = __await__ # make compatible with 'yield from'. | ||
| def __iter__(self): | ||
| warnings.warn("yield from fut is deprecated, please use await fut instead", |
There was a problem hiding this comment.
wording
yield from future and await future
tirkarthi
left a comment
There was a problem hiding this comment.
Some deprecation warnings with ./python.exe -Werror -m test -j4 . test_typing also has a usage of @coroutine
cpython/Lib/test/test_typing.py
Line 1711 in 5eb8b07
test_asyncio
======================================================================
ERROR: test_handle_repr (test.test_asyncio.test_events.HandleTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_events.py", line 2140, in test_handle_repr
cb = asyncio.coroutine(noop)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/asyncio/coroutines.py", line 114, in coroutine
warnings.warn("@coroutine decorator is deprecated, "
DeprecationWarning: @coroutine decorator is deprecated, please use async def function instead
======================================================================
ERROR: test_iter (test.test_asyncio.test_futures.CFutureTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_futures.py", line 376, in test_iter
test()
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_futures.py", line 373, in test
arg1, arg2 = coro()
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_futures.py", line 370, in coro
yield from fut
DeprecationWarning: yield from fut is deprecated, please use await fut instead
======================================================================
ERROR: test_uninitialized (test.test_asyncio.test_futures.CFutureTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_futures.py", line 196, in test_uninitialized
iter(fut)
DeprecationWarning: yield from fut is deprecated, please use await fut instead
======================================================================
ERROR: test_iter (test.test_asyncio.test_futures.CSubFutureTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_futures.py", line 376, in test_iter
test()
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_futures.py", line 373, in test
arg1, arg2 = coro()
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_futures.py", line 370, in coro
yield from fut
DeprecationWarning: yield from fut is deprecated, please use await fut instead
======================================================================
ERROR: test_uninitialized (test.test_asyncio.test_futures.CSubFutureTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_futures.py", line 196, in test_uninitialized
iter(fut)
DeprecationWarning: yield from fut is deprecated, please use await fut instead
======================================================================
ERROR: test_iter (test.test_asyncio.test_futures.PyFutureTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_futures.py", line 376, in test_iter
test()
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_futures.py", line 373, in test
arg1, arg2 = coro()
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_futures.py", line 370, in coro
yield from fut
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/asyncio/futures.py", line 264, in __iter__
warnings.warn("yield from fut is deprecated, please use await fut instead",
DeprecationWarning: yield from fut is deprecated, please use await fut instead
======================================================================
ERROR: test_uninitialized (test.test_asyncio.test_futures.PyFutureTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_futures.py", line 196, in test_uninitialized
iter(fut)
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/asyncio/futures.py", line 264, in __iter__
warnings.warn("yield from fut is deprecated, please use await fut instead",
DeprecationWarning: yield from fut is deprecated, please use await fut instead
======================================================================
ERROR: test_exception_waiter (test.test_asyncio.test_streams.StreamTests)
----------------------------------------------------------------------
Traceback (most recent call last):
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/test/test_asyncio/test_streams.py", line 592, in test_exception_waiter
def set_err():
File "/Users/karthikeyansingaravelan/stuff/python/cpython/Lib/asyncio/coroutines.py", line 114, in coroutine
warnings.warn("@coroutine decorator is deprecated, "
DeprecationWarning: @coroutine decorator is deprecated, please use async def function instead
----------------------------------------------------------------------
Ran 2071 tests in 69.820s
FAILED (errors=8, skipped=102)
|
@tirkarthi thanks! I'll take a look |
|
Well, the change is too aggressive. |
In favor of
async defandawaithttps://bugs.python.org/issue36921