diff options
author | Yury Selivanov <yury@magic.io> | 2018-05-28 20:27:34 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-05-28 20:27:34 (GMT) |
commit | 989b9e0e6d7dd2fa911f9bfd4744e7f3a82d6006 (patch) | |
tree | daf171ce1cdd2908624b75c80a85466e72fa46f6 /Lib/test/test_asyncio/test_events.py | |
parent | 8267ea2e84d355f00654dec3ad782fc7b1f680f1 (diff) | |
download | cpython-989b9e0e6d7dd2fa911f9bfd4744e7f3a82d6006.zip cpython-989b9e0e6d7dd2fa911f9bfd4744e7f3a82d6006.tar.gz cpython-989b9e0e6d7dd2fa911f9bfd4744e7f3a82d6006.tar.bz2 |
bpo-33672: Fix Task.__repr__ crash with Cython's bogus coroutines (GH-7161)
Diffstat (limited to 'Lib/test/test_asyncio/test_events.py')
-rw-r--r-- | Lib/test/test_asyncio/test_events.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py index d7b0a66..ba28e8c 100644 --- a/Lib/test/test_asyncio/test_events.py +++ b/Lib/test/test_asyncio/test_events.py @@ -2784,11 +2784,21 @@ class HandleTests(test_utils.TestCase): coro.cr_running = True self.assertEqual(coroutines._format_coroutine(coro), 'BBB() running') + coro.__name__ = coro.__qualname__ = None + self.assertEqual(coroutines._format_coroutine(coro), + '<CoroLike without __name__>() running') + coro = CoroLike() + coro.__qualname__ = 'CoroLike' # Some coroutines might not have '__name__', such as # built-in async_gen.asend(). self.assertEqual(coroutines._format_coroutine(coro), 'CoroLike()') + coro = CoroLike() + coro.__qualname__ = 'AAA' + coro.cr_code = None + self.assertEqual(coroutines._format_coroutine(coro), 'AAA()') + class TimerTests(unittest.TestCase): |