File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -1152,6 +1152,24 @@ async def run():
11521152
11531153 self .loop .run_until_complete (run ())
11541154
1155+ def test_async_gen_asyncio_anext_tuple_no_exceptions (self ):
1156+ # StopAsyncIteration exceptions should be cleared.
1157+ # See: https://github.com/python/cpython/issues/128078.
1158+
1159+ async def foo ():
1160+ if False :
1161+ yield (1 , 2 )
1162+
1163+ async def run ():
1164+ it = foo ().__aiter__ ()
1165+ with self .assertRaises (StopAsyncIteration ):
1166+ await it .__anext__ ()
1167+ a , b = await anext (it , ('a' , 'b' ))
1168+ self .assertEqual (a , 'a' )
1169+ self .assertEqual (b , 'b' )
1170+
1171+ self .loop .run_until_complete (run ())
1172+
11551173 def test_async_gen_asyncio_anext_stopiteration (self ):
11561174 async def foo ():
11571175 try :
You can’t perform that action at this time.
0 commit comments