File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
pydantic_ai_slim/pydantic_ai
pydantic_graph/pydantic_graph/beta Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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
You can’t perform that action at this time.
0 commit comments