Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,45 @@ Nothing yet.

.. start-releases

.. _changes_7-11-2:

Version 7.11.2 β€” 2025-11-08
---------------------------

- Fix: using the "sysmon" measurement core in 7.11.1, if Python code was
claimed to come from a non-Python file, a ``NotPython`` exception could be
raised. This could happen for example with Jinja templates compiled to
Python, as reported in `issue 2077`_. This is now fixed.

- Doc: corrected the first entry in the 7.11.1 changelog.

.. _issue 2077: https://github.com/nedbat/coveragepy/issues/2077


.. _changes_7-11-1:

Version 7.11.1 β€” 2025-11-07
---------------------------

- Fix: some chanages to details of how the measurement core is chosen, and how
conflicting settings are handled. The "sysmon" core cannot be used with some
conurrency settings, with dynamic context, and in Python 3.12/3.13, with
branch measurement.

- If the core is not specified and defaults to "sysmon" (Python 3.14+), but
other settings conflict with sysmon, then the "ctrace" core will be used
instead with no warning. For concurrency conflicts, this used to produce an
error, as described in `issue 2064`_.

- If the "sysmon" core is explicitly requested in your configuration, but
other settings conflict, an error is now raised. This used to produce a
warning.

- Fix: if the measurement core defaults to "sysmon" (the default for Python
3.14+ since v7.9.1), but sysmon can't support some aspect of your
configuration (concurrency settings, dynamic contexts, and so on), then the
ctrace core is used instead. Previously, this would result in an error.
Now a warning is issued instead, explaining the fallback. An explicit request
An explicit request
for sysmon with conflicting settings will still result in an error. Closes
`issue 2064`_.

Expand Down
3 changes: 3 additions & 0 deletions coverage/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,6 @@ def _debug(msg: str) -> None:
self.systrace = True
else:
raise ConfigError(f"Unknown core value: {core_name!r}")

def __repr__(self) -> str:
return f"<Core tracer_class={self.tracer_class.__name__}>"
10 changes: 9 additions & 1 deletion coverage/sysmon.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from coverage import env
from coverage.bytecode import TBranchTrails, always_jumps, branch_trails
from coverage.debug import short_filename, short_stack
from coverage.exceptions import NotPython
from coverage.misc import isolate_module
from coverage.parser import PythonParser
from coverage.types import (
Expand Down Expand Up @@ -470,5 +471,12 @@ def sysmon_branch_either(
def get_multiline_map(filename: str) -> dict[TLineNo, TLineNo]:
"""Get a PythonParser for the given filename, cached."""
parser = PythonParser(filename=filename)
parser.parse_source()
try:
parser.parse_source()
except NotPython:
# The file was not Python. This can happen when the code object refers
# to an original non-Python source file, like a Jinja template.
# In that case, just return an empty map, which might lead to slightly
# wrong branch coverage, but we don't have any better option.
return {}
return parser.multiline_map
2 changes: 1 addition & 1 deletion coverage/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# version_info: same semantics as sys.version_info.
# _dev: the .devN suffix if any.
version_info = (7, 11, 2, "alpha", 0)
version_info = (7, 11, 3, "alpha", 0)
_dev = 1


Expand Down
6 changes: 3 additions & 3 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,11 @@
# @@@ editable
copyright = "2009–2025, Ned Batchelder" # pylint: disable=redefined-builtin
# The short X.Y.Z version.
version = "7.11.1"
version = "7.11.2"
# The full version, including alpha/beta/rc tags.
release = "7.11.1"
release = "7.11.2"
# The date of release, in "monthname day, year" format.
release_date = "November 7, 2025"
release_date = "November 8, 2025"
# @@@ end

rst_epilog = f"""
Expand Down
8 changes: 4 additions & 4 deletions doc/sample_html/class_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ <h2>
<a class="button current">Classes</a>
</h2>
<p class="text">
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
</div>
</header>
Expand Down Expand Up @@ -567,8 +567,8 @@ <h2>
<footer>
<div class="content">
<p>
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
</div>
<aside class="hidden">
Expand Down
8 changes: 4 additions & 4 deletions doc/sample_html/function_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ <h2>
<a class="button" href="class_index.html">Classes</a>
</h2>
<p class="text">
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
</div>
</header>
Expand Down Expand Up @@ -2567,8 +2567,8 @@ <h2>
<footer>
<div class="content">
<p>
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
</div>
<aside class="hidden">
Expand Down
8 changes: 4 additions & 4 deletions doc/sample_html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ <h2>
<a class="button" href="class_index.html">Classes</a>
</h2>
<p class="text">
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
</div>
</header>
Expand Down Expand Up @@ -184,8 +184,8 @@ <h2>
<footer>
<div class="content">
<p>
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
</div>
<aside class="hidden">
Expand Down
2 changes: 1 addition & 1 deletion doc/sample_html/status.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"note":"This file is an internal implementation detail to speed up HTML report generation. Its format can change at any time. You might be looking for the JSON report: https://coverage.rtfd.io/cmd.html#cmd-json","format":5,"version":"7.11.1","globals":"c3c1b2358f6a019c14ec9f4faf201b0e","files":{"z_7b071bdc2a35fa80___init___py":{"hash":"70a508cdcdeb999b005ef6bbb19ef352","index":{"url":"z_7b071bdc2a35fa80___init___py.html","file":"cogapp/__init__.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":1,"n_excluded":0,"n_missing":0,"n_branches":0,"n_partial_branches":0,"n_missing_branches":0}}},"z_7b071bdc2a35fa80___main___py":{"hash":"6d9d0d551879aa3e73791f40c5739845","index":{"url":"z_7b071bdc2a35fa80___main___py.html","file":"cogapp/__main__.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":3,"n_excluded":0,"n_missing":3,"n_branches":0,"n_partial_branches":0,"n_missing_branches":0}}},"z_7b071bdc2a35fa80_cogapp_py":{"hash":"8922125da4cf1502a014f13a07b2f5fc","index":{"url":"z_7b071bdc2a35fa80_cogapp_py.html","file":"cogapp/cogapp.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":496,"n_excluded":1,"n_missing":241,"n_branches":196,"n_partial_branches":26,"n_missing_branches":138}}},"z_7b071bdc2a35fa80_hashhandler_py":{"hash":"f2049479cfcb9d6ba7bbabbf264c82b4","index":{"url":"z_7b071bdc2a35fa80_hashhandler_py.html","file":"cogapp/hashhandler.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":63,"n_excluded":0,"n_missing":35,"n_branches":24,"n_partial_branches":2,"n_missing_branches":20}}},"z_7b071bdc2a35fa80_makefiles_py":{"hash":"eaf4689c0c47697806b20a0a782f9e2a","index":{"url":"z_7b071bdc2a35fa80_makefiles_py.html","file":"cogapp/makefiles.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":22,"n_excluded":0,"n_missing":18,"n_branches":14,"n_partial_branches":0,"n_missing_branches":14}}},"z_7b071bdc2a35fa80_test_cogapp_py":{"hash":"488a08861eefaccf74264debd183ffde","index":{"url":"z_7b071bdc2a35fa80_test_cogapp_py.html","file":"cogapp/test_cogapp.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":911,"n_excluded":2,"n_missing":643,"n_branches":20,"n_partial_branches":1,"n_missing_branches":17}}},"z_7b071bdc2a35fa80_test_makefiles_py":{"hash":"a4a125d4209ab0e413c7c49768fd322f","index":{"url":"z_7b071bdc2a35fa80_test_makefiles_py.html","file":"cogapp/test_makefiles.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":68,"n_excluded":0,"n_missing":51,"n_branches":6,"n_partial_branches":0,"n_missing_branches":6}}},"z_7b071bdc2a35fa80_test_whiteutils_py":{"hash":"59819ec39ae83287b478821e619c36df","index":{"url":"z_7b071bdc2a35fa80_test_whiteutils_py.html","file":"cogapp/test_whiteutils.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":68,"n_excluded":0,"n_missing":50,"n_branches":0,"n_partial_branches":0,"n_missing_branches":0}}},"z_7b071bdc2a35fa80_utils_py":{"hash":"dff44e8a01e364e7c8dfe182d2be9420","index":{"url":"z_7b071bdc2a35fa80_utils_py.html","file":"cogapp/utils.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":37,"n_excluded":0,"n_missing":8,"n_branches":6,"n_partial_branches":2,"n_missing_branches":2}}},"z_7b071bdc2a35fa80_whiteutils_py":{"hash":"828c0e3a8398ba557c1f936ae3093939","index":{"url":"z_7b071bdc2a35fa80_whiteutils_py.html","file":"cogapp/whiteutils.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":44,"n_excluded":0,"n_missing":5,"n_branches":32,"n_partial_branches":4,"n_missing_branches":4}}}}}
{"note":"This file is an internal implementation detail to speed up HTML report generation. Its format can change at any time. You might be looking for the JSON report: https://coverage.rtfd.io/cmd.html#cmd-json","format":5,"version":"7.11.2","globals":"c3c1b2358f6a019c14ec9f4faf201b0e","files":{"z_7b071bdc2a35fa80___init___py":{"hash":"70a508cdcdeb999b005ef6bbb19ef352","index":{"url":"z_7b071bdc2a35fa80___init___py.html","file":"cogapp/__init__.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":1,"n_excluded":0,"n_missing":0,"n_branches":0,"n_partial_branches":0,"n_missing_branches":0}}},"z_7b071bdc2a35fa80___main___py":{"hash":"6d9d0d551879aa3e73791f40c5739845","index":{"url":"z_7b071bdc2a35fa80___main___py.html","file":"cogapp/__main__.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":3,"n_excluded":0,"n_missing":3,"n_branches":0,"n_partial_branches":0,"n_missing_branches":0}}},"z_7b071bdc2a35fa80_cogapp_py":{"hash":"8922125da4cf1502a014f13a07b2f5fc","index":{"url":"z_7b071bdc2a35fa80_cogapp_py.html","file":"cogapp/cogapp.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":496,"n_excluded":1,"n_missing":241,"n_branches":196,"n_partial_branches":26,"n_missing_branches":138}}},"z_7b071bdc2a35fa80_hashhandler_py":{"hash":"f2049479cfcb9d6ba7bbabbf264c82b4","index":{"url":"z_7b071bdc2a35fa80_hashhandler_py.html","file":"cogapp/hashhandler.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":63,"n_excluded":0,"n_missing":35,"n_branches":24,"n_partial_branches":2,"n_missing_branches":20}}},"z_7b071bdc2a35fa80_makefiles_py":{"hash":"eaf4689c0c47697806b20a0a782f9e2a","index":{"url":"z_7b071bdc2a35fa80_makefiles_py.html","file":"cogapp/makefiles.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":22,"n_excluded":0,"n_missing":18,"n_branches":14,"n_partial_branches":0,"n_missing_branches":14}}},"z_7b071bdc2a35fa80_test_cogapp_py":{"hash":"488a08861eefaccf74264debd183ffde","index":{"url":"z_7b071bdc2a35fa80_test_cogapp_py.html","file":"cogapp/test_cogapp.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":911,"n_excluded":2,"n_missing":643,"n_branches":20,"n_partial_branches":1,"n_missing_branches":17}}},"z_7b071bdc2a35fa80_test_makefiles_py":{"hash":"a4a125d4209ab0e413c7c49768fd322f","index":{"url":"z_7b071bdc2a35fa80_test_makefiles_py.html","file":"cogapp/test_makefiles.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":68,"n_excluded":0,"n_missing":51,"n_branches":6,"n_partial_branches":0,"n_missing_branches":6}}},"z_7b071bdc2a35fa80_test_whiteutils_py":{"hash":"59819ec39ae83287b478821e619c36df","index":{"url":"z_7b071bdc2a35fa80_test_whiteutils_py.html","file":"cogapp/test_whiteutils.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":68,"n_excluded":0,"n_missing":50,"n_branches":0,"n_partial_branches":0,"n_missing_branches":0}}},"z_7b071bdc2a35fa80_utils_py":{"hash":"dff44e8a01e364e7c8dfe182d2be9420","index":{"url":"z_7b071bdc2a35fa80_utils_py.html","file":"cogapp/utils.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":37,"n_excluded":0,"n_missing":8,"n_branches":6,"n_partial_branches":2,"n_missing_branches":2}}},"z_7b071bdc2a35fa80_whiteutils_py":{"hash":"828c0e3a8398ba557c1f936ae3093939","index":{"url":"z_7b071bdc2a35fa80_whiteutils_py.html","file":"cogapp/whiteutils.py","description":"","nums":{"precision":2,"n_files":1,"n_statements":44,"n_excluded":0,"n_missing":5,"n_branches":32,"n_partial_branches":4,"n_missing_branches":4}}}}}
8 changes: 4 additions & 4 deletions doc/sample_html/z_7b071bdc2a35fa80___init___py.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ <h2>
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
<a id="nextFileLink" class="nav" href="z_7b071bdc2a35fa80___main___py.html">&#xbb; next</a>
&nbsp; &nbsp; &nbsp;
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
<aside class="hidden">
<button type="button" class="button_next_chunk" data-shortcut="j"></button>
Expand Down Expand Up @@ -97,8 +97,8 @@ <h2>
<a class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
<a class="nav" href="z_7b071bdc2a35fa80___main___py.html">&#xbb; next</a>
&nbsp; &nbsp; &nbsp;
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
</div>
</footer>
Expand Down
8 changes: 4 additions & 4 deletions doc/sample_html/z_7b071bdc2a35fa80___main___py.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ <h2>
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
<a id="nextFileLink" class="nav" href="z_7b071bdc2a35fa80_cogapp_py.html">&#xbb; next</a>
&nbsp; &nbsp; &nbsp;
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
<aside class="hidden">
<button type="button" class="button_next_chunk" data-shortcut="j"></button>
Expand Down Expand Up @@ -97,8 +97,8 @@ <h2>
<a class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
<a class="nav" href="z_7b071bdc2a35fa80_cogapp_py.html">&#xbb; next</a>
&nbsp; &nbsp; &nbsp;
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
</div>
</footer>
Expand Down
8 changes: 4 additions & 4 deletions doc/sample_html/z_7b071bdc2a35fa80_cogapp_py.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ <h2>
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
<a id="nextFileLink" class="nav" href="z_7b071bdc2a35fa80_hashhandler_py.html">&#xbb; next</a>
&nbsp; &nbsp; &nbsp;
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
<aside class="hidden">
<button type="button" class="button_next_chunk" data-shortcut="j"></button>
Expand Down Expand Up @@ -956,8 +956,8 @@ <h2>
<a class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
<a class="nav" href="z_7b071bdc2a35fa80_hashhandler_py.html">&#xbb; next</a>
&nbsp; &nbsp; &nbsp;
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
</div>
</footer>
Expand Down
8 changes: 4 additions & 4 deletions doc/sample_html/z_7b071bdc2a35fa80_hashhandler_py.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ <h2>
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
<a id="nextFileLink" class="nav" href="z_7b071bdc2a35fa80_makefiles_py.html">&#xbb; next</a>
&nbsp; &nbsp; &nbsp;
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
<aside class="hidden">
<button type="button" class="button_next_chunk" data-shortcut="j"></button>
Expand Down Expand Up @@ -265,8 +265,8 @@ <h2>
<a class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
<a class="nav" href="z_7b071bdc2a35fa80_makefiles_py.html">&#xbb; next</a>
&nbsp; &nbsp; &nbsp;
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
</div>
</footer>
Expand Down
8 changes: 4 additions & 4 deletions doc/sample_html/z_7b071bdc2a35fa80_makefiles_py.html
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,8 @@ <h2>
<a id="indexLink" class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
<a id="nextFileLink" class="nav" href="z_7b071bdc2a35fa80_test_cogapp_py.html">&#xbb; next</a>
&nbsp; &nbsp; &nbsp;
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
<aside class="hidden">
<button type="button" class="button_next_chunk" data-shortcut="j"></button>
Expand Down Expand Up @@ -127,8 +127,8 @@ <h2>
<a class="nav" href="index.html">&Hat; index</a> &nbsp; &nbsp;
<a class="nav" href="z_7b071bdc2a35fa80_test_cogapp_py.html">&#xbb; next</a>
&nbsp; &nbsp; &nbsp;
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.1">coverage.py v7.11.1</a>,
created at 2025-11-07 05:01 -0500
<a class="nav" href="https://coverage.readthedocs.io/en/7.11.2">coverage.py v7.11.2</a>,
created at 2025-11-08 14:30 -0500
</p>
</div>
</footer>
Expand Down
Loading
Loading