Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Phantom lines reported on Python 3.8 #714

Closed
nedbat opened this issue Oct 4, 2018 · 4 comments

Comments

@nedbat
Copy link
Owner

commented Oct 4, 2018

(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.

@nedbat

This comment has been minimized.

Copy link
Owner Author

commented Oct 6, 2018

@lhupfeldt I've made some fixes. Can you try installing from GitHub to see if it works for you?

pip install git+https://github.com/nedbat/coveragepy.git@v4.5.x#egg=coverage==0.0
@lhupfeldt

This comment has been minimized.

Copy link

commented Oct 6, 2018

Solved!

@nedbat

This comment has been minimized.

Copy link
Owner Author

commented Oct 16, 2018

Fixed in 5aca5af (for 5.0) and ccc92dd (for 4.5.x)

@nedbat nedbat closed this Oct 16, 2018
@nedbat

This comment has been minimized.

Copy link
Owner Author

commented Nov 12, 2018

This fix is in 4.5.2, just released: https://pypi.org/project/coverage/4.5.2/

sethmlarson added a commit to sethmlarson/urllib3 that referenced this issue Dec 7, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.