Skip to content

Allow modifying global variables from the variables panel #1857

@Andrej730

Description

@Andrej730

Environment data

  • debugpy version: 1.8.13
  • OS and version: Windows 11
  • Python version (& distribution if applicable, e.g. Anaconda): 3.12.7
  • Using VS Code or Visual Studio: VS Code 1.93.1

Actual behavior

Cursor_z3UFWwrl0Y.mp4

Expected behavior

To either prohibit editing global variable in that case as it's not editable or actually edit it.

Steps to reproduce:

  1. Set breakpoint at b = 35 in the snippet below and run it.
  2. Attach to Python using debugger.
  3. Change c value in Variables section to 1000.
  4. Step Over (F10), global variable is moved to locals and global variable value is reset.

What I've also noticed that if on step 3 I run globals()['c'] in Debug Console, it prints 0 and Variables are reset as we would be on the step 4.

c = 0

def main():
    a = 25

    import debugpy
    debugpy.listen(5678)
    debugpy.wait_for_client()

    b = 35
    print(a + b + c)

if __name__ == "__main__":
    main()

Metadata

Metadata

Assignees

Labels

Fixed in next releaseThis issue has been fixed, but won't be available to customers until the next release.enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions