mirror of
https://github.com/python/cpython.git
synced 2025-08-27 12:16:04 +00:00
bpo-46672: fix NameError
in asyncio.gather
if type check fails (GH-31187)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
This commit is contained in:
parent
e7130c2e8c
commit
4ab8167b9c
3 changed files with 17 additions and 1 deletions
|
@ -3235,6 +3235,20 @@ class CoroutineGatherTests(GatherTestsBase, test_utils.TestCase):
|
|||
test_utils.run_briefly(self.one_loop)
|
||||
self.assertIsInstance(f.exception(), RuntimeError)
|
||||
|
||||
def test_issue46672(self):
|
||||
with mock.patch(
|
||||
'asyncio.base_events.BaseEventLoop.call_exception_handler',
|
||||
):
|
||||
async def coro(s):
|
||||
return s
|
||||
c = coro('abc')
|
||||
|
||||
with self.assertRaises(TypeError):
|
||||
self._gather(c, {})
|
||||
self._run_loop(self.one_loop)
|
||||
# NameError should not happen:
|
||||
self.one_loop.call_exception_handler.assert_not_called()
|
||||
|
||||
|
||||
class RunCoroutineThreadsafeTests(test_utils.TestCase):
|
||||
"""Test case for asyncio.run_coroutine_threadsafe."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue