Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: coveragepy/coveragepy
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 7.15.0
Choose a base ref
...
head repository: coveragepy/coveragepy
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 7.15.1
Choose a head ref
  • 18 commits
  • 45 files changed
  • 6 contributors

Commits on Jul 2, 2026

  1. build: bump version to 7.15.1

    nedbat committed Jul 2, 2026
    Configuration menu
    Copy the full SHA
    68404a1 View commit details
    Browse the repository at this point in the history
  2. docs: one small release tweak

    nedbat committed Jul 2, 2026
    Configuration menu
    Copy the full SHA
    49b1a8a View commit details
    Browse the repository at this point in the history

Commits on Jul 5, 2026

  1. chore: bump actions/setup-python in the action-dependencies group (#2217

    )
    
    Bumps the action-dependencies group with 1 update: [actions/setup-python](https://github.com/actions/setup-python).
    
    
    Updates `actions/setup-python` from 6.2.0 to 6.3.0
    - [Release notes](https://github.com/actions/setup-python/releases)
    - [Commits](actions/setup-python@a309ff8...ece7cb0)
    
    ---
    updated-dependencies:
    - dependency-name: actions/setup-python
      dependency-version: 6.3.0
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: action-dependencies
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jul 5, 2026
    Configuration menu
    Copy the full SHA
    669d261 View commit details
    Browse the repository at this point in the history

Commits on Jul 6, 2026

  1. perf: remove a cast that occurs in the hot path in AstArcAnalyzer (#2213

    )
    
    * Remove a cast that occurs in the hot path in AstArcAnalyzer
    
    * fix formatting
    reaperhulk authored Jul 6, 2026
    Configuration menu
    Copy the full SHA
    fc76909 View commit details
    Browse the repository at this point in the history
  2. perf: use per-instance caches in PythonParser (#2214)

    first_line and exit_counts were cached with functools.lru_cache on the
    methods.  A cache on a method is keyed by (self, args), so it pins the
    parser instances themselves.
    
    Caching on the instance instead makes reporting on a 99-file corpus 29%
    faster (1.78s to 1.27s, nearly all of it collector time) and drops live
    objects after the run from ~387k to ~17k.
    
    
    Claude-Session: https://claude.ai/code/session_019XC1KLKyNuR5dA3YxAkxUC
    
    Co-authored-by: Claude <[email protected]>
    reaperhulk and claude authored Jul 6, 2026
    Configuration menu
    Copy the full SHA
    36a14a0 View commit details
    Browse the repository at this point in the history
  3. perf: cache file reporters and analyses for the whole reporting phase (…

    …#2215)
    
    * cache file reporters and analyses for the whole reporting phase
    
    _analyze and _get_file_reporter used lru_cache(maxsize=1), which
    unfortunately doesn't work when reporting sweeps the file list,
    e.g. pytest-cov's total pass followed by its term report.
    
    We now cache them in per-instance dicts instead, clearing whenever
    measured data changes (flush, load, combine, erase).
    
    * fix linter issues
    reaperhulk authored Jul 6, 2026
    Configuration menu
    Copy the full SHA
    9744860 View commit details
    Browse the repository at this point in the history
  4. perf: only walk statement nodes when scanning for defs and classes (#…

    …2216)
    
    * only walk statement nodes when scanning for defs and classes
    
    _raw_parse and AstArcAnalyzer.analyze used ast.walk to find module,
    function, and class nodes, visiting every node in the tree. Those are
    all statements, which can never appear inside expression subtrees.
    
    We can optimize this with walk_statement_nodes, which is ast.walk
    with the enqueue filtereds.
    
    This also replace analyze()'s per-node getattr dispatch with
    isinstance checks against the three handler types.
    
    * fix lint
    
    * remove unneeded assignment
    reaperhulk authored Jul 6, 2026
    Configuration menu
    Copy the full SHA
    cb7c59a View commit details
    Browse the repository at this point in the history
  5. perf: enable only sys.monitoring events that have registered callbacks (

    #2218)
    
    Local events included PY_RETURN|PY_RESUME even in modes that register
    no callback for them. Enabled events with no callback still dispatch
    on every hit, and never get disabled since only a callback can return
    DISABLE -- so every return/resume of traced code paid dispatch cost
    Line mode also skips the byte-to-line map now, which only arc callbacks
    read.
    reaperhulk authored Jul 6, 2026
    Configuration menu
    Copy the full SHA
    5c32db4 View commit details
    Browse the repository at this point in the history
  6. docs: thanks, Paul Kehrer

    nedbat committed Jul 6, 2026
    Configuration menu
    Copy the full SHA
    3b62112 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    f7e15a8 View commit details
    Browse the repository at this point in the history

Commits on Jul 7, 2026

  1. chore: make upgrade

    nedbat committed Jul 7, 2026
    Configuration menu
    Copy the full SHA
    088dc60 View commit details
    Browse the repository at this point in the history

Commits on Jul 9, 2026

  1. docs: normalize earlier history order (#2222)

    * docs: normalize earlier history order
    
    * no need to mention GDR anymore
    
    ---------
    
    Co-authored-by: Ned Batchelder <[email protected]>
    iamdhrv and nedbat authored Jul 9, 2026
    Configuration menu
    Copy the full SHA
    7c3ae71 View commit details
    Browse the repository at this point in the history

Commits on Jul 11, 2026

  1. fix: escape context labels in html report inline script block (#2224)

    * fix: escape context labels in html report inline script block
    
    * tweak the test for full coverage, and give credit (nedbat)
    
    * r-strings are better (nedbat)
    
    ---------
    
    Co-authored-by: Ned Batchelder <[email protected]>
    rajath201 and nedbat authored Jul 11, 2026
    Configuration menu
    Copy the full SHA
    dd80635 View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2026

  1. chore: bump the action-dependencies group with 6 updates (#2225)

    Bumps the action-dependencies group with 6 updates:
    
    | Package | From | To |
    | --- | --- | --- |
    | [github/codeql-action/init](https://github.com/github/codeql-action) | `4.36.2` | `4.36.3` |
    | [github/codeql-action/autobuild](https://github.com/github/codeql-action) | `4.36.2` | `4.36.3` |
    | [github/codeql-action/analyze](https://github.com/github/codeql-action) | `4.36.2` | `4.36.3` |
    | [dorny/paths-filter](https://github.com/dorny/paths-filter) | `4.0.1` | `4.0.2` |
    | [docker/setup-qemu-action](https://github.com/docker/setup-qemu-action) | `4.1.0` | `4.2.0` |
    | [actions/attest-build-provenance](https://github.com/actions/attest-build-provenance) | `4.1.0` | `4.1.1` |
    
    
    Updates `github/codeql-action/init` from 4.36.2 to 4.36.3
    - [Release notes](https://github.com/github/codeql-action/releases)
    - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
    - [Commits](github/codeql-action@8aad20d...54f647b)
    
    Updates `github/codeql-action/autobuild` from 4.36.2 to 4.36.3
    - [Release notes](https://github.com/github/codeql-action/releases)
    - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
    - [Commits](github/codeql-action@8aad20d...54f647b)
    
    Updates `github/codeql-action/analyze` from 4.36.2 to 4.36.3
    - [Release notes](https://github.com/github/codeql-action/releases)
    - [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
    - [Commits](github/codeql-action@8aad20d...54f647b)
    
    Updates `dorny/paths-filter` from 4.0.1 to 4.0.2
    - [Release notes](https://github.com/dorny/paths-filter/releases)
    - [Changelog](https://github.com/dorny/paths-filter/blob/master/CHANGELOG.md)
    - [Commits](dorny/paths-filter@fbd0ab8...7b450ff)
    
    Updates `docker/setup-qemu-action` from 4.1.0 to 4.2.0
    - [Release notes](https://github.com/docker/setup-qemu-action/releases)
    - [Commits](docker/setup-qemu-action@0611638...96fe6ef)
    
    Updates `actions/attest-build-provenance` from 4.1.0 to 4.1.1
    - [Release notes](https://github.com/actions/attest-build-provenance/releases)
    - [Changelog](https://github.com/actions/attest-build-provenance/blob/main/RELEASE.md)
    - [Commits](actions/attest-build-provenance@a2bbfa2...0f67c3f)
    
    ---
    updated-dependencies:
    - dependency-name: github/codeql-action/init
      dependency-version: 4.36.3
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: action-dependencies
    - dependency-name: github/codeql-action/autobuild
      dependency-version: 4.36.3
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: action-dependencies
    - dependency-name: github/codeql-action/analyze
      dependency-version: 4.36.3
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: action-dependencies
    - dependency-name: dorny/paths-filter
      dependency-version: 4.0.2
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: action-dependencies
    - dependency-name: docker/setup-qemu-action
      dependency-version: 4.2.0
      dependency-type: direct:production
      update-type: version-update:semver-minor
      dependency-group: action-dependencies
    - dependency-name: actions/attest-build-provenance
      dependency-version: 4.1.1
      dependency-type: direct:production
      update-type: version-update:semver-patch
      dependency-group: action-dependencies
    ...
    
    Signed-off-by: dependabot[bot] <[email protected]>
    Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
    dependabot[bot] authored Jul 12, 2026
    Configuration menu
    Copy the full SHA
    1441b96 View commit details
    Browse the repository at this point in the history
  2. perf: compute multiline maps cheaply in the sysmon core (#2220)

    * perf: compute multiline maps cheaply in the sysmon core
    
    The sysmon core needs the multiline map (line -> first line of its
    multi-line statement) to resolve branch events.  It got it by running a
    full PythonParser.parse_source() per file — an ast.parse, a full
    tokenization, a compile() via ByteParser, and AST walks — behind a
    module-level functools.lru_cache(maxsize=20).  Test suites tracing more
    than 20 files thrash that cache and re-parse files repeatedly (the
    pyca/cryptography suite traces 192 files; see issue #2172 for a report
    of sysmon branch mode being slow on such suites).
    
    Three changes:
    
    - Make multiline_map_from_tokens() in parser.py the one place the map
      is computed: PythonParser._raw_parse tokenizes once into a list, gets
      the map from the shared builder, and its own token loop keeps only
      the exclusion and indent bookkeeping (its in-flight first_line
      tracking stays, since the exclusion logic needs the statement start
      before the map entry for the current statement exists).
    
    - Use multiline_map_from_text() in the sysmon core instead of a full
      parse.  This is ~4x cheaper (0.34s vs 1.48s for the 192 files of the
      cryptography suite) and produces identical maps (verified on 445
      files: coverage's own source and tests, the stdlib, cryptography and
      its tests).
    
    - Cache the maps in a plain dict on the SysMonitor instance, unbounded,
      so each traced file is tokenized at most once per run.  The cache
      dies with the tracer, which also removes the cross-run staleness a
      module-level cache can have.
    
    Measured on the cryptography suite (Python 3.14.2, branch mode, wall
    time best of 3, base 35.44s): 47.90s (+35.2%) before, 46.07s (+30.0%)
    after, with byte-identical coverage data.  The parse/report phase pays
    one extra pure-Python pass over the already-materialized token list
    (parse_source() over the 192 files: 1.75s -> 1.95s, ~+1ms per file),
    which the reporting-phase caches already amortize.  Most of the
    remaining measurement overhead is the branch_trails() analysis,
    addressed separately by the sysmon-lazy-branch-resolver branch; the
    two changes compose to ~0-2%.
    
    Verified: parser results (statements, excluded, raw_excluded,
    multiline_map) identical to released main on 445 files with a realistic
    exclusion regex; coverage's own test suite failure set identical to
    released main.
    
    Co-Authored-By: Claude Fable 5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_0137DLbSXfm5v5bhCcz7xEKM
    
    * test: unit-test the multiline map computation and its sysmon cache
    
    Add directed tests of multiline_map_from_text() for each statement shape, plus a parametrized check that it always matches the map PythonParser produces, since branch arcs are attributed with one and reports are keyed by the other.  Also test compute_multiline_map()'s fallbacks for missing, non-Python, and badly indented files, and that SysMonitor computes each file's map at most once per tracer instance.
    
    Co-Authored-By: Claude Fable 5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_0137DLbSXfm5v5bhCcz7xEKM
    
    * make multi-line code snippets actually multi-line
    
    * update changes
    
    ---------
    
    Co-authored-by: Claude <[email protected]>
    Co-authored-by: Ned Batchelder <[email protected]>
    3 people authored Jul 12, 2026
    Configuration menu
    Copy the full SHA
    ee271ee View commit details
    Browse the repository at this point in the history
  3. perf: resolve sysmon branch events lazily, one pair at a time (#2221)

    * perf: resolve sysmon branch events lazily, one pair at a time
    
    On the first BRANCH_LEFT/RIGHT event of every code object, the sysmon
    core precomputed branch trails for every branch site in the code object:
    two full dis.get_instructions() decodes (branch_trails and always_jumps
    each built their own InstructionWalker), two trail walks per conditional
    jump, and re-registration of every trail under every offset it contains.
    On test-suite-shaped workloads — thousands of code objects, most
    branches executed a handful of times — this analysis dominates: branch
    mode on the pyca/cryptography suite (4,277 tests, 5,671 traced code
    objects) costs +35% vs +2% for line mode (issue #2172).
    
    But branch events are one-shot: each (site, direction) fires once and is
    then DISABLEd, so at most two pairs per branch site ever need resolving,
    and only for branches that actually execute.  Replace the precompute
    with a BranchArcResolver that resolves each (source offset, destination
    offset) pair as it arrives, walking the raw co_code bytes from the
    destination — following unconditional jumps, skipping CACHE and
    EXTENDED_ARG, stopping at a new source line (arc), a return (arc to
    exit), or another branch possibility (no arc: that branch produces its
    own events).  Lines come from the byte_to_line dict the tracer already
    builds, so nothing in the branch measurement path disassembles whole
    code objects any more.  branch_trails(), always_jumps(), and
    InstructionWalker become unused and are removed.
    
    Computing jump targets needs the number of inline CACHE entries that
    follow the jump instruction (jump distances are measured from the end
    of the caches).  Rather than reading opcode._inline_cache_entries — a
    private table whose shape has already changed once (list in 3.11, dict
    in 3.12) — the resolver counts the CACHE opcodes directly in co_code:
    exact by construction, self-consistent with the code object being
    walked, and no private API.
    
    Measured on the cryptography suite (Python 3.14.2, branch mode, wall
    time best of 3, base 35.44s): 47.90s (+35.2%) before, 38.33s (+8.2%)
    after; combined with the sysmon-multiline-map branch the overhead is at
    the run-to-run noise floor (~0-2%).  Correctness verified by: coverage's
    own test suite under COVERAGE_CORE=sysmon on 3.14 (identical failure set
    to main, all environmental); resolving 17,445 (source, dest) pairs
    across 3,571 code objects identically to a dis-based reference
    implementation; and byte-identical 'coverage report' output on the
    cryptography suite (26,376 statements, 2,484 branches).  The raw arc
    data differs by five arcs on that suite: the old code's byte_to_line
    fallback recorded arcs between two lines inside the same multi-line
    statement, which the resolver correctly attributes to the statement's
    first line; all five collapse to self-arcs at report time.
    
    Co-Authored-By: Claude Fable 5 <[email protected]>
    Claude-Session: https://claude.ai/code/session_0137DLbSXfm5v5bhCcz7xEKM
    
    * update changes
    
    ---------
    
    Co-authored-by: Claude <[email protected]>
    Co-authored-by: Ned Batchelder <[email protected]>
    3 people authored Jul 12, 2026
    Configuration menu
    Copy the full SHA
    182b010 View commit details
    Browse the repository at this point in the history
  4. docs: prep for 7.15.1

    nedbat committed Jul 12, 2026
    Configuration menu
    Copy the full SHA
    bc35e64 View commit details
    Browse the repository at this point in the history
  5. docs: sample HTML for 7.15.1

    nedbat committed Jul 12, 2026
    Configuration menu
    Copy the full SHA
    da63bed View commit details
    Browse the repository at this point in the history
Loading