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
()
| 6 | |
| 7 | |
| 8 | async 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() |
no outgoing calls