Skip to content

Phantom lines reported on Python 3.8 #714

Closed
@nedbat

Description

(split off from #707)

@lhupfeldt said:

multiconf/envs.py 210 37 82 2 86.644% 313-1149, 91->125, 92->91
This file only has 307 lines, something has gone completely wrong.

Here's my simple reproduction:

$ cat -n multiline.py
     1	def f(x):
     2	    return 17
     3
     4	print(
     5	    f(
     6	        1
     7	    )
     8	)

$ venv38/bin/python3.8 -m coverage run multiline.py
17

$ venv38/bin/python3.8 -m coverage report -m
Name           Stmts   Miss  Cover   Missing
--------------------------------------------
multiline.py       5      2    60%   261-516

Multi-line function calls now include backwards steps in the bytecode-to-line number table, so that the execution can be attributed to the first line instead of the last. Those negative steps are being mis-interpreted by coverage, resulting in phantom lines.

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions