Always greedily `list`-cast`mngrs` input sequence
parent
c606be8c64
commit
b5192cca8e
|
@ -109,6 +109,17 @@ async def gather_contexts(
|
||||||
all_entered = trio.Event()
|
all_entered = trio.Event()
|
||||||
parent_exit = trio.Event()
|
parent_exit = trio.Event()
|
||||||
|
|
||||||
|
# XXX: ensure greedy sequence of manager instances
|
||||||
|
# since a lazy inline generator doesn't seem to work
|
||||||
|
# with `async with` syntax.
|
||||||
|
mngrs = list(mngrs)
|
||||||
|
|
||||||
|
if not mngrs:
|
||||||
|
raise ValueError(
|
||||||
|
'input mngrs is empty?\n'
|
||||||
|
'Did try to use inline generator syntax?'
|
||||||
|
)
|
||||||
|
|
||||||
async with trio.open_nursery() as n:
|
async with trio.open_nursery() as n:
|
||||||
for mngr in mngrs:
|
for mngr in mngrs:
|
||||||
n.start_soon(
|
n.start_soon(
|
||||||
|
|
Loading…
Reference in New Issue