-
-
Notifications
You must be signed in to change notification settings - Fork 30.9k
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
On current main (after applying PEP 669) the tracing behavior changed and can notify about the same line more than once. #103471
Comments
I don't think the tracing mechanism pre-669 keeps the last line being traced. The only test failed without remembering the last traced line is For that test, the code is while i <= 2:
sess = pdb.Pdb()
sess.set_trace(sys._getframe())
print('pdb %d: %s' % (i, sess._previous_sigint_handler))
i += 1 What happened without remembering the last traced line (pre-669 style) is:
This is obviously wrong - after tracing the But "forgetting the last trace line" is not correct either, because we are considering jump and branch as the LINE event trigger for the target line. For code like: if a > 0:
return 1
else:
return 2 After the instrumentation, there will be an instrumented jump, to an instrumented line, which would trigger TWO LINE events. However, the debugger was brought up between these two events. If we turn I think the pre-669 solution is to check the last executed instruction in the frame and see if that instruction is in the same line(or maybe for jump, the target of the instuction) to avoid duplicated events, not remembering the last traced line. So, the current solution is not equivalent to what we had before, and we should probably reconsider if that's the way to go. It seems like checking the last executed line is better than last traced line. |
The original behavior was to see if the offset of previous instruction and the offset of the about-to-be-executed instruction were one of:
We can mimic this by setting a flag in branch and jump events so that the next Unfortunately, it seems that we don't emit |
Can we ask |
@markshannon any news on this one? I'd really like to be able to use |
We need to make sure that we are emitting line events in the right places first (#104239). Should probably be fixed late this week or early next. OOI, are you planning on porting |
I do have plans to do it, but still no timeframe ;) |
The test case for this is below (it works for Python 3.11 and fails in the current master).
The text was updated successfully, but these errors were encountered: