8000 gh-128078: Simplify logic in `_PyGen_SetStopIterationValue` (follow-up to gh-128780) by picnixz · Pull Request #128287 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-128078: Simplify logic in _PyGen_SetStopIterationValue (follow-up to gh-128780) #128287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Jan 13, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
add tests
  • Loading branch information
picnixz committed Dec 27, 2024
commit 0f4180bce2fc03eb4dfd1250bda6b1cb6004dc5b
18 changes: 18 additions & 0 deletions Lib/test/test_asyncgen.py
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,24 @@ async def run():

self.loop.run_until_complete(run())

def test_async_gen_asyncio_anext_tuple_no_exceptions(self):
# StopAsyncIteration exceptions should be cleared.
# See: https://github.com/python/cpython/issues/128078.

async def foo():
if False:
yield (1, 2)

async def run():
it = foo().__aiter__()
with self.assertRaises(StopAsyncIteration):
await it.__anext__()
a, b = await anext(it, ('a', 'b'))
self.assertEqual(a, 'a')
self.assertEqual(b, 'b')

self.loop.run_until_complete(run())

def test_async_gen_asyncio_anext_stopiteration(self):
async def foo():
try:
Expand Down
0