summaryrefslogtreecommitdiff
path: root/coverage/env.py
diff options
context:
space:
mode:
authorNed Batchelder <ned@nedbatchelder.com>2023-03-12 08:31:12 -0400
committerNed Batchelder <ned@nedbatchelder.com>2023-03-12 11:46:25 -0400
commit8eb95b5ad2ed1cee1204b1ce95bad9118063d178 (patch)
treeb3849fe6cc9df4acdcf7006fe9b8d25a2047d10e /coverage/env.py
parentd276fa4f5a20dc3eb4dbf18bf4b8898fb3e24a79 (diff)
downloadpython-coveragepy-git-8eb95b5ad2ed1cee1204b1ce95bad9118063d178.tar.gz
fix: recent pypy3.9 now omits lines after jumps
We were seeing these failures in the nightly builds: ``` FAILED tests/test_arcs.py::LoopArcTest::test_continue - AssertionError: Possible arcs differ: minus is expected, plus is actual (-1, 1) # .1 (1, 2) # 12 (1, 5) # 15 (2, 3) # 23 (3, 1) # 31 - (4, 1) # 41 (5, -1) # 5. Missing arcs differ: minus is expected, plus is actual - (4, 1) # 41 + assert False FAILED tests/test_arcs.py::LoopArcTest::test_break - AssertionError: Possible arcs differ: minus is expected, plus is actual (-1, 1) # .1 (1, 2) # 12 (1, 5) # 15 (2, 3) # 23 (3, 5) # 35 - (4, 1) # 41 (5, -1) # 5. Missing arcs differ: minus is expected, plus is actual (1, 5) # 15 - (4, 1) # 41 assert False FAILED tests/test_arcs.py::ExceptionArcTest::test_raise_followed_by_statement - AssertionError: Possible arcs differ: minus is expected, plus is actual (-1, 1) # .1 (1, 2) # 12 (2, 3) # 23 (3, 4) # 34 (4, 6) # 46 - (5, 8) # 58 (6, 7) # 67 (7, 8) # 78 (8, -1) # 8. Missing arcs differ: minus is expected, plus is actual - (5, 8) # 58 + assert False FAILED tests/test_coverage.py::SimpleStatementTest::test_raise_followed_by_statement - AssertionError: [1, 2, 4, 5] != [1, 2, 3, 4, 5] assert [1, 2, 4, 5] == [1, 2, 3, 4, 5] At index 2 diff: 4 != 3 Right contains one more item: 5 Full diff: - [1, 2, 3, 4, 5] ? --- + [1, 2, 4, 5] FAILED tests/test_coverage.py::SimpleStatementTest::test_break - AssertionError: [1, 2, 3, 5] != [1, 2, 3, 4, 5] assert [1, 2, 3, 5] == [1, 2, 3, 4, 5] At index 3 diff: 5 != 4 Right contains one more item: 5 Full diff: - [1, 2, 3, 4, 5] ? --- + [1, 2, 3, 5] FAILED tests/test_coverage.py::SimpleStatementTest::test_continue - AssertionError: [1, 2, 3, 5] != [1, 2, 3, 4, 5] assert [1, 2, 3, 5] == [1, 2, 3, 4, 5] At index 3 diff: 5 != 4 Right contains one more item: 5 Full diff: - [1, 2, 3, 4, 5] ? --- + [1, 2, 3, 5] ```
Diffstat (limited to 'coverage/env.py')
-rw-r--r--coverage/env.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/coverage/env.py b/coverage/env.py
index 5d69a234..b2229281 100644
--- a/coverage/env.py
+++ b/coverage/env.py
@@ -106,11 +106,17 @@ class PYBEHAVIOR:
# 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.
- omit_after_jump = pep626
+ omit_after_jump = (
+ pep626
+ or (PYPY and PYVERSION >= (3, 9) and PYPYVERSION >= (7, 3, 12))
+ )
# PyPy has always omitted statements after return.
omit_after_return = omit_after_jump or PYPY
+ # Optimize away unreachable try-else clauses.
+ optimize_unreachable_try_else = pep626
+
# Modules used to have firstlineno equal to the line number of the first
# real line of code. Now they always start at 1.
module_firstline_1 = pep626