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

Spurious LINE event when tracing asyncio.tasks.sleep #92236

Closed
markshannon opened this issue May 3, 2022 · 8 comments
Closed

Spurious LINE event when tracing asyncio.tasks.sleep #92236

markshannon opened this issue May 3, 2022 · 8 comments
Labels
type-bug An unexpected behavior, bug, or error

Comments

@markshannon
Copy link
Member

See nedbat/coveragepy#1368 (comment) for report.

Although this occurs in asyncio.tasks.sleep I suspect that this this is more generally related to entering coroutines and generators.

@markshannon markshannon added the type-bug An unexpected behavior, bug, or error label May 3, 2022
@markshannon
Copy link
Member Author

Reproducer:
nedbat/coveragepy#1368 (comment)

@nedbat
Copy link
Member

nedbat commented May 6, 2022

Is there any chance of this being addressed in time for 3.11b1?

@markshannon
Copy link
Member Author

Sorry, I was unable to reproduce this, so I couldn't make for a test for it nor fix it.

I think I know what the issue is now.
There is a spurious LINE event before the call, but pure Python tracing ignores LINE events that occur before the CALL event because f_trace is unset until set by the global trace function.
C tracing functions see this LINE event.

@nedbat
Copy link
Member

nedbat commented May 12, 2022

Where does this leave us? Is this something that will change in CPython, or does coverage.py need to adapt?

@markshannon
Copy link
Member Author

I'm fixing it. It just didn't make it into 3.11b1, obviously. It will be in 3.11b2

@markshannon
Copy link
Member Author

#92722

nedbat added a commit to nedbat/coveragepy that referenced this issue May 12, 2022
nedbat added a commit to nedbat/coveragepy that referenced this issue May 12, 2022
miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 13, 2022
…or generator. (pythonGH-92722)

(cherry picked from commit 22a1db3)

Co-authored-by: Mark Shannon <[email protected]>
markshannon pushed a commit that referenced this issue May 13, 2022
@markshannon
Copy link
Member Author

markshannon commented May 13, 2022

@nedbat thanks once again for finding yet another tracing bug.

@nedbat
Copy link
Member

nedbat commented May 13, 2022

It's my only CPython expertise! Happy to help :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

3 participants
@nedbat @markshannon and others