"To measure your code, coverage.py needs to know what code got executed. To know that, it collects execution events from the Python interpreter. CPython now has two mechanisms for this: trace functions and sys.monitoring. Coverage.py has two implementations of a trace function (in C and in Python), and an implementation of a sys.monitoring listener. These three components are the measurement cores, known as "ctrace", "pytrace", and "sysmon"."
"The fastest is sysmon, but there are coverage.py features it doesn't yet support. With Python 3.14, sysmon is the default core. Issue 2064 complained that when the defaulted core conflicted with an explicit concurrency choice, the conflict resulted in an error. I agreed with the issue: since the core was defaulted, it shouldn't be an error, we should choose a different core."
"Implementing all that got a little involved because of "metacov": coverage.py coverage-measuring itself. The sys.monitoring facility in Python was added in 3.12, but wasn't fully fleshed out enough to do branch coverage until 3.14. When we measure ourselves, we use branch coverage, so 3.12 and 3.13 needed some special handling to avoid causing the error that sysmon plus branch coverage would cause."
Three releases of coverage.py addressed conflicts and missing coverage when using different measurement cores. Coverage.py determines executed code by collecting interpreter execution events via trace functions or sys.monitoring. The project provides ctrace, pytrace, and sysmon measurement cores. Sysmon is the fastest and became the default on Python 3.14, but lacks support for some coverage.py features. A conflict arose when the default sysmon core clashed with an explicit concurrency setting; defaulting the core should avoid causing an error while an explicit sysmon request with conflicting settings should raise an error. Measuring coverage-measuring (metacov) required special handling on Python 3.12–3.13 for branch coverage.
Read at Nedbatchelder
Unable to calculate read time
Collection
[
|
...
]