-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
bpo-36921: Deprecate @coroutine and yield from in asyncio #13334
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
matrixise
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asvetlov nice PR ;-) but maybe use coroutine and future instead of coro and fut...
| 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wording
yield from future and await future
tirkarthi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
| @asyncio.coroutine |
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