diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 48f9e10b0..a88a80f3e 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -51,7 +51,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3 + uses: github/codeql-action/init@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -62,7 +62,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3 + uses: github/codeql-action/autobuild@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3 # â„šī¸ Command-line programs to run using the OS shell. # 📚 https://git.io/JvXDl @@ -76,4 +76,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@ff0a06e83cb2de871e5a09832bc6a81e7276941f # v3 + uses: github/codeql-action/analyze@ce28f5bb42b7a9f2c824e633a3f6ee835bab6858 # v3 diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml index 4ba98033d..070b5ff07 100644 --- a/.github/workflows/dependency-review.yml +++ b/.github/workflows/dependency-review.yml @@ -19,6 +19,7 @@ permissions: jobs: dependency-review: + name: "Review dependencies" if: github.repository_owner == 'nedbat' runs-on: ubuntu-latest steps: diff --git a/.github/workflows/kit.yml b/.github/workflows/kit.yml index 0fd0534ea..9447a651a 100644 --- a/.github/workflows/kit.yml +++ b/.github/workflows/kit.yml @@ -324,7 +324,7 @@ jobs: files=$(ls coverage-* 2>/dev/null | wc -l) && [ "$files" -eq $EXPECTED ] || exit 1 - name: "Sign artifacts" - uses: sigstore/gh-action-sigstore-python@f514d46b907ebcd5bedc05145c03b69c1edd8b46 # v3.0.0 + uses: sigstore/gh-action-sigstore-python@f7ad0af51a5648d09a20d00370f0a91c3bdf8f84 # v3.0.1 with: inputs: coverage-*.* diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 7533c9840..18a393302 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -81,7 +81,7 @@ jobs: files=$(ls dist 2>/dev/null | wc -l) && [ "$files" -eq $EXPECTED ] || exit 1 - name: "Generate attestations" - uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0 + uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0 with: subject-path: "dist/*" @@ -121,7 +121,7 @@ jobs: files=$(ls dist 2>/dev/null | wc -l) && [ "$files" -eq $EXPECTED ] || exit 1 - name: "Generate attestations" - uses: actions/attest-build-provenance@db473fddc028af60658334401dc6fa3ffd8669fd # v2.3.0 + uses: actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0 with: subject-path: "dist/*" diff --git a/.github/workflows/python-nightly.yml b/.github/workflows/python-nightly.yml index c6dc6a7f3..6eaee452d 100644 --- a/.github/workflows/python-nightly.yml +++ b/.github/workflows/python-nightly.yml @@ -31,52 +31,29 @@ concurrency: jobs: tests: - name: "${{ matrix.python-version }}${{ matrix.nogil && ' nogil' || '' }} on ${{ matrix.os-short }}" + name: "${{ matrix.python-version }}" runs-on: "${{ matrix.os }}" # If it doesn't finish in an hour, it's not going to. Don't spin for six # hours needlessly. timeout-minutes: 60 env: - TOX_GH_MAJOR_MINOR: "${{ matrix.python-version }}${{ matrix.nogil && 't' || '' }}" + TOX_GH_MAJOR_MINOR: "${{ matrix.python-version }}" strategy: matrix: os: - # Choose a recent Ubuntu that deadsnakes still builds all the versions for. - # For example, deadsnakes doesn't provide 3.10 nightly for 22.04 (jammy) - # because jammy ships 3.10, and deadsnakes doesn't want to clobber it. - # https://launchpad.net/~deadsnakes/+archive/ubuntu/nightly/+packages - # https://github.com/deadsnakes/issues/issues/234 - # See https://github.com/deadsnakes/nightly for the source of the nightly - # builds. - # bionic: 18, focal: 20, jammy: 22, noble: 24 - - "ubuntu-22.04" - os-short: - - "ubuntu" + - "ubuntu-latest" python-version: # When changing this list, be sure to check the [gh] list in # tox.ini so that tox will run properly. PYVERSIONS - # Available versions: - # https://launchpad.net/~deadsnakes/+archive/ubuntu/nightly/+packages - "3.12" - "3.13" + - "3.13t" - "3.14" + - "3.14t" - "3.15" - # https://github.com/actions/setup-python#available-versions-of-pypy - - "pypy-3.11" - nogil: - - false - - true - # include: - # - python-version: "pypy-3.11" - # os: "windows-latest" - # os-short: "windows" - exclude: - - python-version: "3.12" - nogil: true - - python-version: "pypy-3.11" - nogil: true + - "3.15t" fail-fast: false @@ -86,18 +63,28 @@ jobs: with: persist-credentials: false - - name: "Install ${{ matrix.python-version }} with deadsnakes" - uses: deadsnakes/action@e640ac8743173a67cca4d7d77cd837e514bf98e8 # v3.2.0 - if: "!startsWith(matrix.python-version, 'pypy-')" - with: - python-version: "${{ matrix.python-version }}-dev" - nogil: "${{ matrix.nogil || false }}" + - name: "Install system dependencies" + run: | + sudo sed -i.bak 's/^Types: deb$/Types: deb deb-src/' /etc/apt/sources.list.d/ubuntu.sources + sudo apt-get update + sudo apt-get build-dep -y python3 - - name: "Install ${{ matrix.python-version }} with setup-python" - uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0 - if: "startsWith(matrix.python-version, 'pypy-')" - with: - python-version: "${{ matrix.python-version }}-nightly" + - name: "Install pyenv" + run: | + curl -L https://github.com/pyenv/pyenv-installer/raw/master/bin/pyenv-installer | bash + + - name: "Build Python ${{ matrix.python-version }}-dev" + env: + PYVER: "${{ matrix.python-version }}-dev" + #PYTHON_CONFIGURE_OPTS: "--enable-shared --disable-test-modules" + run: | + set -xe + export PYENV_ROOT="$HOME/.pyenv" + export PATH="$PYENV_ROOT/bin:$PATH" + echo "$PYENV_ROOT/shims:$PYENV_ROOT/bin" >> $GITHUB_PATH + pyenv install $PYVER -v + pyenv global $PYVER + pyenv rehash - name: "Show diagnostic info" run: | @@ -110,21 +97,15 @@ jobs: python -m coverage debug pybehave env | sort - - name: "Check build recency" - shell: python + - name: "Check the Python version" + env: + EXPECTED: "${{ matrix.python-version }}" run: | - import platform - from datetime import datetime - for fmt in ["%b %d %Y %H:%M:%S", "%b %d %Y"]: - try: - built = datetime.strptime(platform.python_build()[1], fmt) - except ValueError: - continue - days = (datetime.now() - built).days - impl = platform.python_implementation() - recency = 7 if (impl == "CPython") else 21 - print(f"Days since {impl} was built: {days}, need within {recency}") - assert days <= recency + python -c " + import sys + assert sys.version.startswith('$EXPECTED'.strip('t')) + assert getattr(sys, '_is_gil_enabled', lambda: True)() == (not '$EXPECTED'.endswith('t')) + " - name: "Install dependencies" run: | diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 0e1650fed..fc2dbb273 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -173,7 +173,7 @@ jobs: persist-credentials: false - name: Install the latest version of uv - uses: astral-sh/setup-uv@f0ec1fc3b38f5e7cd731bb6ce540c5af426746bb #v6.1.0 + uses: astral-sh/setup-uv@445689ea25e0de0a23313031f5fe577c74ae45a1 #v6.3.0 with: enable-cache: false diff --git a/CHANGES.rst b/CHANGES.rst index 909cc5c8a..19666e165 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -22,6 +22,21 @@ upgrading your version of coverage.py. .. start-releases +.. _changes_7-9-2: + +Version 7.9.2 — 2025-07-03 +-------------------------- + +- Fix: complex conditionals within a line might cause a KeyError when using + sys.monitoring, as reported in `issue 1991`_. This is now fixed. + +- Fix: we can now measure coverage for code in Python archive (.par) files. + Thanks, `Itamer Oren `_. + +.. _pull 1984: https://github.com/nedbat/coveragepy/pull/1984 +.. _issue 1991: https://github.com/nedbat/coveragepy/issues/1991 + + .. _changes_7-9-1: Version 7.9.1 — 2025-06-13 diff --git a/CONTRIBUTORS.txt b/CONTRIBUTORS.txt index bd83cfb3f..c0ea942a1 100644 --- a/CONTRIBUTORS.txt +++ b/CONTRIBUTORS.txt @@ -190,6 +190,7 @@ Ori Avtalion Pablo Carballo Pankaj Pandey Patrick Mezard +Paul Timmins Pavel Tsialnou Peter Baughman Peter Ebden diff --git a/README.rst b/README.rst index ba436e037..c34644ce2 100644 --- a/README.rst +++ b/README.rst @@ -26,7 +26,7 @@ Coverage.py runs on these versions of Python: .. PYVERSIONS -* Python 3.9 through 3.14 beta 2, including free-threading. +* Python 3.9 through 3.14 beta 3, including free-threading. * PyPy3 versions 3.9, 3.10, and 3.11. Documentation is on `Read the Docs`_. Code repository and issue tracker are on diff --git a/coverage/files.py b/coverage/files.py index 21ba3f167..bdc3633b5 100644 --- a/coverage/files.py +++ b/coverage/files.py @@ -166,7 +166,7 @@ def zip_location(filename: str) -> tuple[str, str] | None: name is in the zipfile. """ - for ext in [".zip", ".whl", ".egg", ".pex"]: + for ext in [".zip", ".whl", ".egg", ".pex", ".par"]: zipbase, extension, inner = filename.partition(ext + sep(filename)) if extension: zipfile = zipbase + ext diff --git a/coverage/sysmon.py b/coverage/sysmon.py index 2c4602765..94b28b9ff 100644 --- a/coverage/sysmon.py +++ b/coverage/sysmon.py @@ -448,8 +448,8 @@ def sysmon_branch_either( # This could be an exception jumping from line to line. assert code_info.byte_to_line is not None l1 = code_info.byte_to_line[instruction_offset] - l2 = code_info.byte_to_line[destination_offset] - if l1 != l2: + l2 = code_info.byte_to_line.get(destination_offset) + if l2 is not None and l1 != l2: arc = (l1, l2) code_info.file_data.add(arc) # type: ignore # log(f"adding unforeseen {arc=}") diff --git a/coverage/version.py b/coverage/version.py index aef3c5ddb..2ebe99b1f 100644 --- a/coverage/version.py +++ b/coverage/version.py @@ -8,7 +8,7 @@ # version_info: same semantics as sys.version_info. # _dev: the .devN suffix if any. -version_info = (7, 9, 1, "final", 0) +version_info = (7, 9, 2, "final", 0) _dev = 0 diff --git a/doc/conf.py b/doc/conf.py index ce73075e0..6fee3cd3f 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -67,11 +67,11 @@ # @@@ editable copyright = "2009–2025, Ned Batchelder" # pylint: disable=redefined-builtin # The short X.Y.Z version. -version = "7.9.1" +version = "7.9.2" # The full version, including alpha/beta/rc tags. -release = "7.9.1" +release = "7.9.2" # The date of release, in "monthname day, year" format. -release_date = "June 13, 2025" +release_date = "July 3, 2025" # @@@ end rst_epilog = f""" diff --git a/doc/index.rst b/doc/index.rst index 5efa10570..83ebeaaf1 100644 --- a/doc/index.rst +++ b/doc/index.rst @@ -18,7 +18,7 @@ supported on: .. PYVERSIONS -* Python 3.9 through 3.14 beta 2, including free-threading. +* Python 3.9 through 3.14 beta 3, including free-threading. * PyPy3 versions 3.9, 3.10, and 3.11. .. ifconfig:: prerelease diff --git a/doc/sample_html/class_index.html b/doc/sample_html/class_index.html index a6e0b4bf7..de94105ee 100644 --- a/doc/sample_html/class_index.html +++ b/doc/sample_html/class_index.html @@ -56,8 +56,8 @@

Classes

- coverage.py v7.9.1, - created at 2025-06-13 08:29 -0400 + coverage.py v7.9.2, + created at 2025-07-03 06:03 -0400

@@ -567,8 +567,8 @@

- coverage.py v7.9.1, - created at 2025-06-13 08:29 -0400 + coverage.py v7.9.2, + created at 2025-07-03 06:03 -0400

diff --git a/doc/sample_html/z_7b071bdc2a35fa80_hashhandler_py.html b/doc/sample_html/z_7b071bdc2a35fa80_hashhandler_py.html index c67c8648b..91e030904 100644 --- a/doc/sample_html/z_7b071bdc2a35fa80_hashhandler_py.html +++ b/doc/sample_html/z_7b071bdc2a35fa80_hashhandler_py.html @@ -66,8 +66,8 @@

^ index     » next       - coverage.py v7.9.1, - created at 2025-06-13 08:29 -0400 + coverage.py v7.9.2, + created at 2025-07-03 06:03 -0400