mirror of
https://github.com/python/cpython.git
synced 2025-08-04 08:59:19 +00:00
bpo-43216: Remove @asyncio.coroutine (GH-26369)
Remove the @asyncio.coroutine decorator enabling legacy generator-based coroutines to be compatible with async/await code; remove asyncio.coroutines.CoroWrapper used for wrapping legacy coroutine objects in the debug mode. The decorator has been deprecated since Python 3.8 and the removal was initially scheduled for Python 3.10.
This commit is contained in:
parent
3623aaa78c
commit
a1092f6249
11 changed files with 85 additions and 763 deletions
|
@ -123,20 +123,6 @@ class CoroutineTests(BaseTest):
|
|||
async def foo(): pass
|
||||
self.assertTrue(asyncio.iscoroutinefunction(foo))
|
||||
|
||||
def test_function_returning_awaitable(self):
|
||||
class Awaitable:
|
||||
def __await__(self):
|
||||
return ('spam',)
|
||||
|
||||
with self.assertWarns(DeprecationWarning):
|
||||
@asyncio.coroutine
|
||||
def func():
|
||||
return Awaitable()
|
||||
|
||||
coro = func()
|
||||
self.assertEqual(coro.send(None), 'spam')
|
||||
coro.close()
|
||||
|
||||
def test_async_def_coroutines(self):
|
||||
async def bar():
|
||||
return 'spam'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue