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

Line numbers wrong with Python 3.8 #190

Closed
martinstein opened this issue Nov 5, 2019 · 6 comments · Fixed by #208
Closed

Line numbers wrong with Python 3.8 #190

martinstein opened this issue Nov 5, 2019 · 6 comments · Fixed by #208

Comments

@martinstein
Copy link

martinstein commented Nov 5, 2019

After upgrading my local project to Python 3.8, the line numbers that py-spy reports are about 3-8 times too high (difference varies). This affects both the flamegraph and the speedscope output.

Environment:
Python 3.8.0
Windws 10 Pro, Version 10.0.18362 Build 18362
py-spy==0.3.0 (but I believe it affects earlier versions, too)

Note: This situation occurs when the program that is analyzed is running on Python 3.8 and it's independent of the Python environment that I start py-spy from. To clarify:

  • Profiled code runs in: 3.7, py-spy runs in: 3.7 -> line numbers OK
  • Profiled code runs in: 3.7, py-spy runs in: 3.8 -> line numbers OK
  • Profiled code runs in: 3.8, py-spy runs in: 3.7 -> line numbers wrong
  • Profiled code runs in: 3.8, py-spy runs in: 3.8 -> line numbers wrong
benfred added a commit that referenced this issue Nov 17, 2019
Line number increments in the line number table can be negative occasionally,
and since we were loading as a table of u8 this wasn't being handled appropiately.
This might be causing issues like #190

Change to match the logic in https://github.com/python/cpython/blob/143a97f6/Objects/lnotab_notes.txt#L48-L49
@benfred
Copy link
Owner

benfred commented Nov 17, 2019

I haven't managed to replicate this - but after looking into that code I realized there is a bug there that could be causing this issue =( I have a fix in #196 that I hope will fix this issue.

@Nudin
Copy link
Contributor

Nudin commented Nov 23, 2019

I have the same issue.
To test #196 I cloned the repo, and ran python ./setup.py install --user – and the line numbers are still of by a factor of nearly 100.

@martinstein
Copy link
Author

Yup, I can confirm that with the latest release v0.3.1 this issue still exists. @benfred Is there some information from my Python environment that I can give you that might help you in narrowing this down?

@benfred
Copy link
Owner

benfred commented Dec 22, 2019

#208 fixes this issue - will be the in the next release

@benfred
Copy link
Owner

benfred commented Jan 2, 2020

Fix is in v0.3.2

@martinstein
Copy link
Author

Yup, can confirm that line numbers work perfectly again. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants