Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Issue with debugpy affecting objects refcount

未关闭
#1,854 7 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

@rchiodo 已经在做这个了。

开始于 2025年3月4日。

评估

这个 Issue 还没有评估数据。

描述

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

主要语言
Python
星标
2.5k
派生
205
平均合并
1 天 43 分钟
30 天内合并 PR
6

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/debugpy 的其他 Issue

查看 microsoft/debugpy 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。