diff --git a/Lib/asyncio/coroutines.py b/Lib/asyncio/coroutines.py index 896cc560789..a70eb1dd91b 100644 --- a/Lib/asyncio/coroutines.py +++ b/Lib/asyncio/coroutines.py @@ -252,6 +252,8 @@ def _format_coroutine(coro): if isinstance(coro, CoroWrapper): func = coro.func coro_name = coro.__qualname__ + if coro_name is not None: + coro_name = '{}()'.format(coro_name) else: func = coro diff --git a/Lib/test/test_asyncio/test_pep492.py b/Lib/test/test_asyncio/test_pep492.py index 82bb9953b82..c7d5f217ce6 100644 --- a/Lib/test/test_asyncio/test_pep492.py +++ b/Lib/test/test_asyncio/test_pep492.py @@ -142,7 +142,7 @@ class CoroutineTests(BaseTest): foo_coro = foo() self.assertRegex( repr(foo_coro), - r'') + r'') with support.check_warnings((r'.*foo.*was never', RuntimeWarning)):