mirror of
https://github.com/python/cpython.git
synced 2025-08-04 00:48:58 +00:00
Issue #28492: Fix how StopIteration is raised in _asyncio.Future
This commit is contained in:
parent
82919ec44f
commit
a4b884f900
3 changed files with 34 additions and 2 deletions
|
@ -464,6 +464,19 @@ class FutureTests(test_utils.TestCase):
|
|||
futures._set_result_unless_cancelled(fut, 2)
|
||||
self.assertTrue(fut.cancelled())
|
||||
|
||||
def test_future_stop_iteration_args(self):
|
||||
fut = asyncio.Future(loop=self.loop)
|
||||
fut.set_result((1, 2))
|
||||
fi = fut.__iter__()
|
||||
result = None
|
||||
try:
|
||||
fi.send(None)
|
||||
except StopIteration as ex:
|
||||
result = ex.args[0]
|
||||
else:
|
||||
self.fail('StopIteration was expected')
|
||||
self.assertEqual(result, (1, 2))
|
||||
|
||||
|
||||
class FutureDoneCallbackTests(test_utils.TestCase):
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue