Warn when sysmon cannot switch dynamic contexts - #2234
Merged
nedbat merged 8 commits intoJul 27, 2026
Conversation
Member
|
This is now released as part of coverage 7.15.3. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Add an explicit core capability for dynamic contexts and warn once when
switch_context()is used with the sys.monitoring core.Why
The sysmon core cannot currently honor dynamic context switches. Programmatic calls previously continued silently, which could produce incomplete per-context data without any indication to the caller.
Fixes #2200
Tests
COVERAGE_CORE=sysmon python -m pytest -q tests/test_api.py::ApiTest::test_switch_context_sysmon_warningCOVERAGE_CORE=ctrace python -m pytest -q tests/test_api.py::SwitchContextTestCOVERAGE_CORE=pytrace python -m pytest -q tests/test_api.py::SwitchContextTestHYPOTHESIS_PROFILE=ci tox -q -e py314python -m mypy --python-version=3.14 --strict coverage tests setup.pyruff format --check coverage/control.py coverage/core.py tests/test_api.pypython -m pylint --notes= coverage/control.py coverage/core.py tests/test_api.pypre-commit run --files coverage/control.py coverage/core.py tests/test_api.py