mirror of
https://github.com/python/cpython.git
synced 2025-10-17 20:28:43 +00:00
bpo-33672: Fix Task.__repr__ crash with Cython's bogus coroutines (GH-7161)
This commit is contained in:
parent
8267ea2e84
commit
989b9e0e6d
4 changed files with 60 additions and 39 deletions
|
@ -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):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue