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

Warnings are not shown while evaluating expressions in the debug console #774

Closed
david-cortes opened this issue Oct 31, 2021 · 5 comments
Closed
Labels
enhancement New feature or request

Comments

@david-cortes
Copy link

Environment data

  • debugpy version: 1.5.0
  • OS and version: debian sid
  • Python version (& distribution if applicable, e.g. Anaconda): 3.9.7, from anaconda
  • Using VS Code or Visual Studio: vscode

Steps to reproduce:

  1. Put a breakpoint right after a function that would throw a warning.
  2. Execute code that would reach the breakpoint and would get the warning issued.

Actual behavior

Does not show the warning anywhere while debugging.

Expected behavior

Should show warnings in the terminal pane while debugging, in the same part where stdout is written to.

@int19h int19h added needs investigation enhancement New feature or request labels Nov 10, 2021
@fabioz
Copy link
Collaborator

fabioz commented Jan 28, 2022

Turning on/off warnings is something that can change the behavior of applications. Some frameworks (such as pytest) do enable the warnings (and enabling warnings when testing does make sense), but I think the debugger should be agnostic here.

-- just because you're using the debugger doesn't mean you want the warnings... if you do want warnings, I think you should explicitly enable that when launching the debugger and not having the debugger automatically do that (so, I think this is out of the scope of the debugger).

Given that, I'm currently -1 on this request... @int19h do you have different thoughts here or can I close the issue?

@david-cortes
Copy link
Author

Turning on/off warnings is something that can change the behavior of applications. Some frameworks (such as pytest) do enable the warnings (and enabling warnings when testing does make sense), but I think the debugger should be agnostic here.

-- just because you're using the debugger doesn't mean you want the warnings... if you do want warnings, I think you should explicitly enable that when launching the debugger and not having the debugger automatically do that (so, I think this is out of the scope of the debugger).

Given that, I'm currently -1 on this request... @int19h do you have different thoughts here or can I close the issue?

Indeed - that's why they are important for debugging purposes. The default in a python interpreter is to show all warnings, while disabling them requires user action - why would a debugger behave differently from the regular interpreter in that regard?

BTW, there's no button to turn warnings on or off in the debug panel.

@fabioz
Copy link
Collaborator

fabioz commented Jan 28, 2022

Indeed - that's why they are important for debugging purposes. The default in a python interpreter is to show all warnings, while disabling them requires user action - why would a debugger behave differently from the regular interpreter in that regard?

BTW, there's no button to turn warnings on or off in the debug panel.

Sorry, I don't follow here... you mean you usually get warnings but not when debugging? Can you give some code example to reproduce this?

@david-cortes
Copy link
Author

Tried again with the latest version of vscode and the debugger - now warnings are shown correctly in the non-interactive terminal, but are not printed when executed as a statement in the debugger console:
py_warning

@fabioz fabioz changed the title Warnings are not shown Warnings are not shown while evaluating expressions in the console Jan 28, 2022
@fabioz
Copy link
Collaborator

fabioz commented Jan 28, 2022

Thanks for the explanation... the warnings in this case were really silenced as a part of #190.

It seems maybe it got to far when it silenced warnings when evaluating user expressions from the debug console.

@fabioz fabioz changed the title Warnings are not shown while evaluating expressions in the console Warnings are not shown while evaluating expressions in the debug console Jan 28, 2022
fabioz added a commit to fabioz/debugpy that referenced this issue Apr 22, 2022
fabioz added a commit to fabioz/debugpy that referenced this issue Apr 22, 2022
fabioz added a commit to fabioz/debugpy that referenced this issue Apr 22, 2022
fabioz added a commit to fabioz/debugpy that referenced this issue Apr 22, 2022
@fabioz fabioz closed this as completed in eaadb6c Apr 23, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants