Environment data
- debugpy version: 1.8.1
- OS and version: Windows 11
- Python version (& distribution if applicable, e.g. Anaconda): Python 3.11
- Using VS Code or Visual Studio: VS Code 1.93.1
Actual behavior
Consider snippet below - when executing with a debugger attached it fails with an error below.
x.resize(4)
ValueError: cannot resize an array that references or is referenced
by another array in this way.
Use the np.resize function or refcheck=False
import numpy as np
import sys
# import debugpy
# debugpy.listen(5678)
# debugpy.wait_for_client()
x = np.ones(3)
print(sys.getrefcount(x))
# ValueError: cannot resize an array that references or is referenced
# by another array in this way.
# Use the np.resize function or refcheck=False
x.resize(4)
print(x)
Investigating I've noticed 3 different behaviours:
-
Running it just using python test.py - prints 2 as the refcount and produce no errors.
-
Running it using VS Code's "Debug Python File"

or by uncommenting debugpy part and attaching debugger later - it prints 2 but fails with an error.
-
Running it with VS Code/debugpy debugger but setting breakpoint at x = np.ones(3) and then stepping through all lines - then it prints 3 and also fails with an error.
Expected behavior
Code execution not to be affected by the debugging process.
Related - IfcOpenShell/IfcOpenShell#6256
Environment data
Actual behavior
Consider snippet below - when executing with a debugger attached it fails with an error below.
Investigating I've noticed 3 different behaviours:
Running it just using
python test.py- prints2as the refcount and produce no errors.Running it using VS Code's "Debug Python File"

or by uncommenting
debugpypart and attaching debugger later - it prints2but fails with an error.Running it with VS Code/debugpy debugger but setting breakpoint at
x = np.ones(3)and then stepping through all lines - then it prints3and also fails with an error.Expected behavior
Code execution not to be affected by the debugging process.
Related - IfcOpenShell/IfcOpenShell#6256