-
Notifications
You must be signed in to change notification settings - Fork 144
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
Code work well but debugger returns a mistake. #348
Comments
@fabioz, this might be another manifestation of the root cause #346 - repros in VSCode on 3.7 (i.e. with native bits), but not on 3.8. Furthermore, repro does depend on where exactly breakpoints are set - in my experiments, it requires breakpoints on lines 2 and 3, but having it on 3 alone works fine. So I think there's some interaction between those two that causes the conditional logic behind the iterator to take a wrong path somewhere. |
@wuyudi, please try the workaround in #346 (comment) while we investigate. |
I'll investigate this one too (along with #346). |
I believe I found the culprit here... the problem is that in frame evaluation mode a generator creates a new frame each time it's suspended and then later resumed but keeps on reusing the same code. There's a provision so that the same code is returned, but in this particular case it doesn't seem to work properly (it uses the lines in the function for the breakpoints, but when adding the breakpoint itself it adds a new line prior to the needed line and this ends up confusing this cache on a subsequent invocation). I'm already working on a fix (as a note, the same issue could happen when breakpoints are changed for generators, so, the fix should also cover that). Note: given that this is related to generators, this is probably a different issue from #346 (although I still haven't investigated nor reproduced that one). |
I encountered a similar issue which seems to be fixed with fabioz@ef4245f print("before loop")
async def hundredFramesPassed():
while memory.read_u32(0x8063fc2c) < 100:
await event.frameadvance()
foo = hundredFramesPassed()
await hundredFramesPassed()
print("I lived!") I consistently reproduced the issue by
On the current master this exception is thrown:
Using https://github.com/fabioz/debugpy/commits/debugpy_348 it doesn't crash and |
Environment data
python.languageServer
setting: "Microsoft"Expected behaviour
This code below is worked properly.
Actual behaviour
I add break points at each line,and debug it, then it returns
Steps to reproduce:
[NOTE: Self-contained, minimal reproducing code samples are extremely helpful and will expedite addressing your issue]
this
list_iterator object
is vanished at the last time. But debugger tried to visit it, and throw out a mistake.Logs
Output for
Python
in theOutput
panel (View
→Output
, change the drop-down the upper-right of theOutput
panel toPython
)The text was updated successfully, but these errors were encountered: