Debugger is entering runpy.py for no reason
ibobak opened this issue · 6 comments
Type: Bug
Behaviour
When debugging the following code I am redirected to some internal module - see below.
This should not happen.
Steps to reproduce:
Use this code:
class Node:
def __init__(self, a_val) -> None:
self.val = a_val
self.next = None
def __eq__(self, value: object) -> bool:
if isinstance(value, Node):
return self.val == value.val
return False
a = Node(20)
b = Node(20)
print(a==b)
after pressing F10 I will get this:
Diagnostic data
launch.json
configuration
XXX
Output for Python
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python
)
XXX
Output for Python Debugger
in the Output
panel (View
→Output
, change the drop-down the upper-right of the Output
panel to Python Debugger
)
XXX
Extension version: 2024.6.0
VS Code version: Code 1.89.1 (dc96b837cf6bb4af9cd736aa3af08cf8279f7685, 2024-05-07T05:16:23.416Z)
OS version: Linux x64 6.4.6-060406-generic
Modes:
- Python version (& distribution if applicable, e.g. Anaconda): 3.10.9
- Type of virtual environment used (e.g. conda, venv, virtualenv, etc.): Conda
Item | Value |
---|---|
CPUs | Intel(R) Xeon(R) CPU E5-2696 v4 @ 2.20GHz (88 x 1197) |
GPU Status | 2d_canvas: enabled canvas_oop_rasterization: disabled_off direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: disabled_off video_decode: enabled video_encode: disabled_software vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: disabled_off |
Load (avg) | 1, 1, 1 |
Memory (System) | 251.76GB (87.86GB free) |
Process Argv | --crash-reporter-id 27d42247-63fb-4d9e-9cb0-87d9974843dc |
Screen Reader | no |
VM | 50% |
DESKTOP_SESSION | ubuntu-xorg |
XDG_CURRENT_DESKTOP | Unity |
XDG_SESSION_DESKTOP | ubuntu-xorg |
XDG_SESSION_TYPE | x11 |
A/B Experiments
vsliv368:30146709
vspor879:30202332
vspor708:30202333
vspor363:30204092
vscoreces:30445986
vscod805:30301674
binariesv615:30325510
vsaa593:30376534
py29gd2263:31024239
c4g48928:30535728
azure-dev_surveyone:30548225
2i9eh265:30646982
962ge761:30959799
pythongtdpath:30769146
welcomedialog:30910333
pythonidxpt:30866567
pythonnoceb:30805159
asynctok:30898717
pythontestfixt:30902429
pythonregdiag2:30936856
pythonmypyd1:30879173
pythoncet0:30885854
h48ei257:31000450
pythontbext0:30879054
accentitlementst:30995554
dsvsc016:30899300
dsvsc017:30899301
dsvsc018:30899302
cppperfnew:31000557
dsvsc020:30976470
pythonait:31006305
chatpanelt:31048053
dsvsc021:30996838
9c06g630:31013171
pythoncenvpt:31049070
a69g1124:31058053
pythonprt:31056678
dwnewjupyter:31046869
26j00206:31048877
Thanks for the bug report, could you share the config in your launch.json file? and the value of Just My Code
in settings. Thanks
launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python Debugger: Current File",
"type": "debugpy",
"request": "launch",
"program": "${file}",
"console": "integratedTerminal"
}
]
}
It seems like a problem with debugpy. Could you try again with the latest version of the extension? We updated the debugpy version to the latest.
The problem is still fully reproducible with the newest version: https://youtu.be/Bayb3c6pvEo
That's the last line of execution and you have justMyCode turned off. It's stepping into the code that called you. (running under the debugger launches the program differently)
This should be by design. I don't believe pydevd modules are special cased to not count towards stepping when justMyCode is false.
Yeah it's the runpy in the system runtime, so it's not even stepping through the debugger code. It's stepping through the code that's running in the system.
I suppose we could special case this situation to detect that it's the last line of the program? Seems like overkill though.