Skip to content
Open
Changes from all commits
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
11 changes: 10 additions & 1 deletion peps/pep-0828.rst
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,8 @@ async one before calling ``async yield from``.
async def __anext__(self):
try:
return self._wrapped.__next__()
except StopAsyncIteration as e:
raise RuntimeError("async generator raised StopAsyncIteration") from e
except StopIteration as e:
raise StopAsyncIteration(e.value) from e

Expand All @@ -404,17 +406,24 @@ async one before calling ``async yield from``.
async def asend(self, value):
try:
return self._wrapped.send(value)
except StopAsyncIteration as e:
raise RuntimeError("async generator raised StopAsyncIteration") from e
except StopIteration as e:
raise StopAsyncIteration(e.value) from e

async def athrow(self, exc):
try:
return self._wrapped.throw(exc)
except StopAsyncIteration as e:
raise RuntimeError("async generator raised StopAsyncIteration") from e
except StopIteration as e:
raise StopAsyncIteration(e.value) from e

async def aclose(self):
return self._wrapped.close()
try:
return self._wrapped.close()
except StopAsyncIteration as e:
raise RuntimeError("async generator raised StopAsyncIteration") from e


async def agen():
Expand Down
Loading