MCPcopy
hub / github.com/python-trio/trio / detachable_coroutine

Function detachable_coroutine

src/trio/_core/_tests/test_run.py:2432–2444  ·  view source on GitHub ↗
(
        task_outcome: outcome.Outcome[None],
        yield_value: object,
    )

Source from the content-addressed store, hash-verified

2430 pdco_outcome: outcome.Outcome[str] | None = None
2431
2432 async def detachable_coroutine(
2433 task_outcome: outcome.Outcome[None],
2434 yield_value: object,
2435 ) -> None:
2436 await sleep(0)
2437 nonlocal task, pdco_outcome
2438 task = _core.current_task()
2439 # `No overload variant of "acapture" matches argument types "Callable[[Outcome[object]], Coroutine[Any, Any, object]]", "Outcome[None]"`
2440 pdco_outcome = await outcome.acapture( # type: ignore[call-overload]
2441 _core.permanently_detach_coroutine_object,
2442 task_outcome,
2443 )
2444 await async_yield(yield_value)
2445
2446 async with _core.open_nursery() as nursery:
2447 nursery.start_soon(detachable_coroutine, outcome.Value(None), "I'm free!")

Callers

nothing calls this directly

Calls 2

sleepFunction · 0.85
async_yieldFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…