From 4668a92c8d8f467fbe6291fa4f56e96e19709e90 Mon Sep 17 00:00:00 2001 From: Ned Batchelder Date: Wed, 19 Oct 2022 20:39:44 -0700 Subject: [PATCH] fix: can't use PYPYVERSION without checking PYPY first --- CHANGES.rst | 4 ++++ coverage/env.py | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index 19a140f90..24f50907f 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -30,7 +30,11 @@ Unreleased - A ``[paths]`` setting like ``*/foo`` will now match ``foo/bar.py`` so that relative file paths can be combined more easily. +- Fix internal logic that prevented coverage.py from running on implementations + other than CPython or PyPy (`issue 1474`_). + .. _issue 991: https://github.com/nedbat/coveragepy/issues/991 +.. _issue 1474: https://github.com/nedbat/coveragepy/issues/1474 .. _changes_6-5-0: diff --git a/coverage/env.py b/coverage/env.py index 13411699a..820016f4e 100644 --- a/coverage/env.py +++ b/coverage/env.py @@ -85,7 +85,10 @@ class PYBEHAVIOR: nix_while_true = (PYVERSION >= (3, 8)) # CPython 3.9a1 made sys.argv[0] and other reported files absolute paths. - report_absolute_files = ((CPYTHON or (PYPYVERSION >= (7, 3, 10))) and PYVERSION >= (3, 9)) + report_absolute_files = ( + (CPYTHON or (PYPY and PYPYVERSION >= (7, 3, 10))) + and PYVERSION >= (3, 9) + ) # Lines after break/continue/return/raise are no longer compiled into the # bytecode. They used to be marked as missing, now they aren't executable.