Skip to content

Commit d03f0d3

Browse files
committed
Try fixing after merging main
1 parent cc97d06 commit d03f0d3

File tree

2 files changed

+6
-1
lines changed
  • pydantic_ai_slim/pydantic_ai
  • pydantic_graph/pydantic_graph/beta

2 files changed

+6
-1
lines changed

pydantic_ai_slim/pydantic_ai/run.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,11 @@ async def main():
237237
"""
238238
# Note: It might be nice to expose a synchronous interface for iteration, but we shouldn't do it
239239
# on this class, or else IDEs won't warn you if you accidentally use `for` instead of `async for` to iterate.
240-
task = await self._graph_run.next([self._node_to_task(node)])
240+
task = [self._node_to_task(node)]
241+
try:
242+
task = await self._graph_run.next(task)
243+
except StopAsyncIteration:
244+
pass
241245
return self._task_to_node(task)
242246

243247
# TODO (v2): Make this a property

pydantic_graph/pydantic_graph/beta/graph.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -628,6 +628,7 @@ async def iter_graph( # noqa C901
628628
await self._finish_task(t.task_id)
629629
self._handle_execution_request(maybe_overridden_result) # pragma: no cover
630630
except GeneratorExit:
631+
self._task_group.cancel_scope.cancel()
631632
return
632633

633634
raise RuntimeError( # pragma: no cover

0 commit comments

Comments
 (0)