You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature request: support dynamic_context with the sysmon measurement core #2150
The sysmon measurement core (introduced in 7.9.0 and default on Python 3.14+) does not support dynamic_context. When e.g. dynamic_context = test_function is configured, coverage.py falls back to the ctrace core, forgoing the performance benefits of sys.monitoring.
For projects that use both branch = True and dynamic_context = test_function, the sysmon core is never used — even on Python 3.14+ where it's the default and where branch coverage is now supported.
Describe the solution you'd like
Support dynamic_context = test_function (and ideally other dynamic context strategies) when using the sysmon measurement core, so that projects using dynamic contexts can benefit from the lower overhead of sys.monitoring on Python 3.14+.
Additional context
The config docs for [run] core note: "The sysmon core does not yet support plugins, dynamic contexts, or some concurrency libraries."
Branch coverage support for sysmon on 3.14+ was added in 7.11.1. This request is about the remaining gap: dynamic contexts.
I'd like to find time to explore how much of the sys.monitoring benefit we could keep while using dynamic contexts. sys.monitoring avoids overhead by letting us disable events after they've been fired once. But dynamic contexts only work by continually examining the context, so we need to keep some events permanently enabled.
Activity
nedbat commentedon Mar 29, 2026
I'd like to find time to explore how much of the sys.monitoring benefit we could keep while using dynamic contexts. sys.monitoring avoids overhead by letting us disable events after they've been fired once. But dynamic contexts only work by continually examining the context, so we need to keep some events permanently enabled.
Fix python 3.14+ missing test coverage
Fix python 3.14+ missing test coverage
Fix python 3.14+ missing test coverage