You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I did an investigation here and the bytecode seems to be correct. What is happening is that on one run it seems like CPython doesn't report a line event while using the same bytecode (after inserting a programmatic breakpoint) it does.
I haven't really dug into CPython itself to know why it started with this behavior in CPython 3.10.5, but from what I've investigated, everything seems correct (the strange thing is that on the initial case before the programmatic breakpoint that line event isn't reported).
i.e.: Given some code as:
@staticmethod
def fun2():
a = 1
for i in range(1):
for j in range(1, 3):
if i + j >= 1:
break
Now, when on line 61, in the bytecode: 44 JUMP_FORWARD 1 (to 48), it should report a line event from line 61 to line 60, but this line event is NOT reported in the initial case, but after doing bytecode manipulation it is reported. My guess is that this is some optimization that CPython is doing when the file is loaded from disk the first time, whereas this isn't applied when we modify the bytecode directly on memory (I didn't really dig further in the CPython codebase to know the exact cause as I'm convinced already that the bytecode that the debugger generates is correct in this case).
Given that, I'll just use this issue to fix the test where this happens.
fabioz
added a commit
to fabioz/debugpy
that referenced
this issue
Jul 8, 2022
There's a failing test in the pydevd test suite related to bytecode which is failing only in Python 3.10.5.
This should be investigated (it could be a real error).
The text was updated successfully, but these errors were encountered: