diff --git a/slurry/sections/_producers.py b/slurry/sections/_producers.py index a0f15f0..098c4ae 100644 --- a/slurry/sections/_producers.py +++ b/slurry/sections/_producers.py @@ -94,16 +94,17 @@ async def refine(self, input, output): # pylint: disable=line-too-long raise RuntimeError('If Repeat is used as first section, default value must be provided.') - input = cast(AsyncIterable[Any], input) item = self.default if self.has_default else None async def pull_task(cancel_scope, *, task_status=trio.TASK_STATUS_IGNORED): nonlocal item - async for item in input: - task_status.started() - break - async for item in input: - pass + if input: + async for item in input: + break + task_status.started() + if input: + async for item in input: + pass cancel_scope.cancel() async with trio.open_nursery() as nursery: