Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Issue with debugpy affecting objects refcount

Aperta
#1,854 7 commenti 0 reazioni 1 assegnatario Vedi su GitHub

@rchiodo ci sta già lavorando.

Dal 4/3/2025.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

bug needs repro

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:

  1. Running it just using python test.py - prints 2 as the refcount and produce no errors.

  2. Running it using VS Code's "Debug Python File"
    Image
    or by uncommenting debugpy part and attaching debugger later - it prints 2 but fails with an error.

  3. 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 - https://github.com/IfcOpenShell/IfcOpenShell/issues/6256

Lingua principale
Python
Stelle
2.5k
Fork
205
Merge medio
1g 9h
PR unite (30g)
3

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di microsoft/debugpy

Tutte le issue di microsoft/debugpy

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.