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

Some variables not assigned when using debug console #915

Closed
ssavary opened this issue Apr 19, 2022 · 1 comment
Closed

Some variables not assigned when using debug console #915

ssavary opened this issue Apr 19, 2022 · 1 comment
Labels

Comments

@ssavary
Copy link

ssavary commented Apr 19, 2022

Issue Type: Bug

Tested on VSCode 1.66.x. Does not seem to occur with 1.65.x

  1. Run some code
  2. stop on a break point.
  3. some variables assigned by code prior to beakpoint (e.g. A = 10, B = 30)
  4. execute a function that returns multiple variable and put into existing variables in local context (e.g. A, B = some_fun())
  5. A does not get assigned with a new value.

Here is some code that reproduces the problem (with line numbers). Set a breakpoint on line

import numpy as np

def some_fun():
    return np.random.randn(), np.random.randn()

def some_fun_2():
    return np.random.randn()

def main():
    A = 10
    B = 34
    C = 11

    A, B = some_fun() # this assignment works when stepping
    print(A) # break on this line

Once the code has stopped on breakpoint, execute A, B = some_fun() in the Debug Console to experiment the bug.

These have the same erroneous behaviour:
A, B = np.random.randn(), np.random.randn()
B, A = np.random.randn(), np.random.randn()
B, A = some_fun()

However, A = some_fun_2() works fine.

python 3.8.10
Extension version: 2022.4.1
VS Code version: Code 1.66.2 (dfd34e8260c270da74b5c2d86d61aee4b6d56977, 2022-04-11T07:49:20.994Z)
OS version: Darwin x64 20.6.0
Restricted Mode: No

System Info
Item Value
CPUs Intel(R) Core(TM) i7-8850H CPU @ 2.60GHz (12 x 2600)
GPU Status 2d_canvas: enabled
canvas_oop_rasterization: disabled_off
direct_rendering_display_compositor: disabled_off_ok
gpu_compositing: enabled
metal: disabled_off
multiple_raster_threads: enabled_on
oop_rasterization: enabled
opengl: enabled_on
rasterization: enabled
raw_draw: disabled_off_ok
skia_renderer: enabled_on
video_decode: enabled
video_encode: enabled
webgl: enabled
webgl2: enabled
Load (avg) 3, 3, 3
Memory (System) 32.00GB (0.06GB free)
Process Argv --crash-reporter-id 2a273040-cc5d-49bc-b505-46f4293dc6a3 --crash-reporter-id 2a273040-cc5d-49bc-b505-46f4293dc6a3
Screen Reader no
VM 0%
A/B Experiments
vsliv368cf:30146710
vsreu685:30147344
python383cf:30185419
vspor879:30202332
vspor708:30202333
vspor363:30204092
pythonvspyl392:30443607
pythontb:30283811
pythonptprofiler:30281270
vshan820:30294714
vstes263:30335439
vscoreces:30445986
pythondataviewer:30285071
vscod805cf:30301675
pythonvspyt200:30340761
binariesv615:30325510
bridge0708:30335490
bridge0723:30353136
vsaa593cf:30376535
vsc1dst:30438360
pythonvs932:30410667
wslgetstarted:30449410
pythonvsnew555:30457759
vscscmwlcmt:30465135
vscaat:30438848

@ssavary ssavary changed the title Some variables not assigned using debug console Some variables not assigned when using debug console Apr 19, 2022
@karthiknadig karthiknadig transferred this issue from microsoft/vscode-python Apr 20, 2022
fabioz added a commit to fabioz/debugpy that referenced this issue Apr 21, 2022
@ssavary
Copy link
Author

ssavary commented Apr 21, 2022

It seems that variables that already exist in the local context are the ones affected by this bug.

Executing multiple lines in the debug console also triggers this bug. For example, say that a, b, and c already exist when stopping on breakpoint, executing those 3 lines using the console will only modify the contents of c.
a = np.random.randn()
b = np.random.randn()
c = np.random.randn()

However, if I run these lines instead (with d not already existing):
d = np.random.randn()
b = np.random.randn()
c = np.random.randn()

Only d gets created and assigned. b and c are left untouched.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant