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

Function is looping once upon raising exception only when called in debug console #742

Closed
joe-pierce opened this issue Oct 6, 2021 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@joe-pierce
Copy link

joe-pierce commented Oct 6, 2021

Environment data

  • debugpy version: 1.4.3
  • OS and version: Windows 10.0.19042 N/A Build 19042
  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.5 Anaconda 64bit
  • Using VS Code or Visual Studio: VS Code 1.60.2

Actual behavior

When an exception is raised within a function, and that function is called from the debug console, it repeats the function once again (but only once). Error only occurs when calling function from debug console, if just stepping through in debug mode or running the code normally it does not occur

Expected behavior

The exception should just be raised as normal.

Steps to reproduce:

Include an exception in a basic function and call it from the debug console.

image

@int19h
Copy link
Collaborator

int19h commented Oct 6, 2021

Since there's only one traceback, the function is only executed once; it looks like it just duplicated the output. We had a bug about that - #133 - but it's supposed to be fixed, so we must have regressed that somehow.

If the underlying cause is the same, try setting "redirectOutput": false in your launch.json, and see if that helps.

@int19h int19h added the bug Something isn't working label Oct 6, 2021
@joe-pierce
Copy link
Author

Hi , thanks for your reply. Setting "redirectOutput": false doesn't solve the issue for me. It does seem like the function is executed twice rather than just duplicating the output, since the function i originally noticed this on includes a subprocess call to set an external process going, plus a time.sleep() call, and you see the external process open and start twice, and the same pause between twice - does that seem like a different issue?

@fabioz fabioz self-assigned this Oct 7, 2021
@fabioz
Copy link
Collaborator

fabioz commented Oct 7, 2021

I can reproduce this.

The issue is that it doesn't pre-verify if it should be an exec or eval (it does this by checking for an exception on the eval and retrying for exec).

I'll fix this shortly.

fabioz added a commit to fabioz/debugpy that referenced this issue Oct 7, 2021
fabioz added a commit to fabioz/debugpy that referenced this issue Oct 7, 2021
fabioz added a commit to fabioz/debugpy that referenced this issue Oct 7, 2021
@fabioz fabioz closed this as completed in 765b64c Oct 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants