diff options
| author | Ned Batchelder <ned@nedbatchelder.com> | 2022-01-30 07:01:29 -0500 |
|---|---|---|
| committer | Ned Batchelder <ned@nedbatchelder.com> | 2022-02-06 11:09:53 -0500 |
| commit | 82ae658412ede7519d6212724e45714f8daa765e (patch) | |
| tree | a8fac1b911aacd7515dc665741a1d0965223b6dd /coverage | |
| parent | 87b2117f26677c21d7ffbf46b59b287183d4ca7a (diff) | |
| download | python-coveragepy-git-82ae658412ede7519d6212724e45714f8daa765e.tar.gz | |
test: adapt to PyPy 3.9 v7.8.8
Diffstat (limited to 'coverage')
| -rw-r--r-- | coverage/env.py | 20 | ||||
| -rw-r--r-- | coverage/parser.py | 4 |
2 files changed, 15 insertions, 9 deletions
diff --git a/coverage/env.py b/coverage/env.py index cf2f9d26..b76a206b 100644 --- a/coverage/env.py +++ b/coverage/env.py @@ -50,9 +50,11 @@ class PYBEHAVIOR: optimize_if_not_debug2 = (not PYPY) and (PYVERSION >= (3, 8, 0, 'beta', 1)) if pep626: optimize_if_not_debug2 = False + if PYPY and (PYVERSION >= (3, 9)): + optimize_if_not_debug2 = True # Yet another way to optimize "if not __debug__"? - optimize_if_not_debug3 = (PYPY and PYVERSION >= (3, 8)) + optimize_if_not_debug3 = (PYPY and (3, 8) <= PYVERSION <= (3, 9)) # Can co_lnotab have negative deltas? negative_lnotab = not (PYPY and PYPYVERSION < (7, 2)) @@ -71,11 +73,19 @@ class PYBEHAVIOR: # (old behavior)? trace_decorated_def = (CPYTHON and PYVERSION >= (3, 8)) + # Functions are no longer claimed to start at their earliest decorator even though + # the decorators are traced? + def_ast_no_decorator = (PYPY and PYVERSION >= (3, 9)) + + # CPython 3.11 now jumps to the decorator line again while executing + # the decorator. + trace_decorator_line_again = (CPYTHON and PYVERSION > (3, 11, 0, 'alpha', 3, 0)) + # Are while-true loops optimized into absolute jumps with no loop setup? nix_while_true = (PYVERSION >= (3, 8)) - # Python 3.9a1 made sys.argv[0] and other reported files absolute paths. - report_absolute_files = (PYVERSION >= (3, 9)) + # CPython 3.9a1 made sys.argv[0] and other reported files absolute paths. + report_absolute_files = (CPYTHON 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. @@ -100,10 +110,6 @@ class PYBEHAVIOR: # Some words are keywords in some places, identifiers in other places. soft_keywords = (PYVERSION >= (3, 10)) - # CPython 3.11 now jumps to the decorator line again while executing - # the decorator. - trace_decorator_line_again = (PYVERSION > (3, 11, 0, 'alpha', 3, 0)) - # Coverage.py specifics. diff --git a/coverage/parser.py b/coverage/parser.py index a96964d4..6a9f083c 100644 --- a/coverage/parser.py +++ b/coverage/parser.py @@ -692,7 +692,7 @@ class AstArcAnalyzer: def _line_decorated(self, node): """Compute first line number for things that can be decorated (classes and functions).""" lineno = node.lineno - if env.PYBEHAVIOR.trace_decorated_def: + if env.PYBEHAVIOR.trace_decorated_def or env.PYBEHAVIOR.def_ast_no_decorator: if node.decorator_list: lineno = node.decorator_list[0].lineno return lineno @@ -946,7 +946,7 @@ class AstArcAnalyzer: main_line = last = node.lineno decs = node.decorator_list if decs: - if env.PYBEHAVIOR.trace_decorated_def: + if env.PYBEHAVIOR.trace_decorated_def or env.PYBEHAVIOR.def_ast_no_decorator: last = None for dec_node in decs: dec_start = self.line_for_node(dec_node) |
