mirror of
https://github.com/PrefectHQ/fastmcp.git
synced 2026-08-17 02:59:11 +02:00
* Fix: gather() eagerly creates coroutines before scheduling them AggregateProvider fans out Provider.get_tool() (and sibling calls) across child providers via gather(*[p.get_tool(x) for p in providers]). The list comprehension builds every coroutine up front, then gather()'s scheduling loop hands them to an anyio task group one at a time. If that loop is interrupted partway through - e.g. by pytest-timeout's SIGALRM-based per-test timeout, which can fire between any two bytecode instructions, unlike normal async cancellation - any coroutine not yet scheduled is abandoned and silently garbage collected later, producing a "coroutine 'Provider.get_tool' was never awaited" warning attributed to whatever unrelated test happens to be running when the GC gets to it. Change gather() to take a single iterable consumed lazily, one awaitable at a time, right before each is scheduled, and close any awaitable that was just retrieved if scheduling it raises. Update call sites to pass generator expressions instead of eagerly-built lists so coroutine creation and scheduling stay tightly coupled. * Close unscheduled awaitables from eager callers; make get_tasks lazy |
||
|---|---|---|
| .. | ||
| json_schema_type | ||
| openapi | ||
| __init__.py | ||
| httpx2_mock.py | ||
| test_asgi_transport.py | ||
| test_async_utils.py | ||
| test_auth.py | ||
| test_cli.py | ||
| test_components.py | ||
| test_docstring_parsing.py | ||
| test_http.py | ||
| test_inspect.py | ||
| test_inspect_icons.py | ||
| test_json_schema.py | ||
| test_logging.py | ||
| test_skills.py | ||
| test_tests.py | ||
| test_timeout.py | ||
| test_token_cache.py | ||
| test_typeadapter.py | ||
| test_types.py | ||
| test_version_check.py | ||