Skip to content

del doesn't delete object and x = None doesn't create None object #1138

@rcasero

Description

@rcasero

Before creating a new issue, please check the FAQ to see if your question is answered there.

Environment data

  • debugpy version: 1.6.3 (run import debugpy; print(debugpy.__version__) if uncertain)
  • OS and version: MacOS X Ventura 13.0.1
  • Python version (& distribution if applicable, e.g. Anaconda): 3.8.13, miniconda 3
  • Using VS Code or Visual Studio: VS Code Version: 1.73.1 (Universal)

Actual behavior

In Debug Console

  • del x is ignored.
  • x = None doesn't create an object.

Expected behavior

  • del x should delete the object.
  • x = None should create an object with None value.

Steps to reproduce:

  1. Create dummy script with just
    import sys
    and place a breakpoint on that line
  2. Start debugging session using remote -SSH extension on server running Linux CentOS Stream 8, with Microsoft Python extension and following launch.json. The script
    {
        "version": "0.2.0",
        "configurations": [
            {
                "name":       "Python: Current File",
                "type":       "python",
                "request":    "launch",
                "cwd":        "${workspaceFolder}/bin",
                "program":    "${file}",
                "console":    "integratedTerminal",
                "redirectOutput": true,
                "justMyCode": true,
                "env": {"PYDEVD_WARN_SLOW_RESOLVE_TIMEOUT": "2"}
            }
        ]
    }
  3. Go to Debug Console
  4. Create variable x=5
  5. Print variable print(x). This shows 5
  6. Delete variable del x.
  7. Print deleted variable print(x). This still shows 5. Even after import gc; gc.collect(), x still exists.
  8. Create new variable with None value. y = None
  9. Print new variable print(y). This produces the error
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
    NameError: name 'y' is not defined
    
  10. However, if a previously defined variable is assigned None, e.g. x = None, then the variable is still defined.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions