MCPcopy
hub / github.com/modelcontextprotocol/python-sdk / resync_tracer

Function resync_tracer

src/mcp/shared/_compat.py:8–19  ·  view source on GitHub ↗

Resync coverage tracing after a cancelled task-group join. A cancel delivered at a join resumes the awaiting coroutine chain via `coro.throw()`; on CPython 3.11 (python/cpython#106749) that drops the `'call'` trace events for the outer frames and desyncs coverage's CTracer until the

()

Source from the content-addressed store, hash-verified

6
7
8async def resync_tracer() -> None:
9 """Resync coverage tracing after a cancelled task-group join.
10
11 A cancel delivered at a join resumes the awaiting coroutine chain via
12 `coro.throw()`; on CPython 3.11 (python/cpython#106749) that drops the
13 `'call'` trace events for the outer frames and desyncs coverage's CTracer
14 until the chain next suspends and resumes normally. Yielding once here
15 resumes via `.send()`, which re-stamps the missing events. Shielded so a
16 pending outer cancel is not re-delivered at this point; behaviorally a
17 no-op. Delete this module when Python 3.11 support ends (EOL 2027-10).
18 """
19 await anyio.lowlevel.cancel_shielded_checkpoint()

Calls

no outgoing calls