Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

AttributeError on Debug Run with PyTest

オープン
#1,951 コメント 3 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
python

調査の方向性

まず debugpy 1.8.16 で pytest の実行を再現し、1.8.15 と比較します。報告された _ClassVar の検索箇所周辺にある debugpy/adapter/main.py、debugpy/public_api.py、バンドルされた dataclasses.py を読みます。完了条件は、報告された環境で collection が完了し、wait_for_client() がタイムアウトしなくなることです。

索引モデルが issue の本文から書いたものです。

説明

user responded

Environment data

  • debugpy version: 1.8.16
  • OS and version: Ubuntu 20.04.6 LTS
  • Python version: 3.12.3
  • Using VS Code or Visual Studio: VS Code

Actual behavior

collecting ... Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/__main__.py", line 229, in <module>
    __import__("debugpy")
  File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/../../debugpy/__init__.py", line 36, in <module>
    from debugpy.public_api import *  # noqa
    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/../../debugpy/public_api.py", line 25, in <module>
    @dataclasses.dataclass(frozen=True)
     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/../../dataclasses.py", line 950, in wrap
    return _process_class(cls, init, repr, eq, order, unsafe_hash, frozen)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/../../dataclasses.py", line 800, in _process_class
    cls_fields = [_get_field(cls, name, type)
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/../../dataclasses.py", line 659, in _get_field
    if (_is_classvar(a_type, typing)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/jp/.pyenv/versions/3.12.3/envs/dev/lib/python3.12/site-packages/debugpy/adapter/../../dataclasses.py", line 550, in _is_classvar
    return type(a_type) is typing._ClassVar
                           ^^^^^^^^^^^^^^^^
AttributeError: module 'typing' has no attribute '_ClassVar'. Did you mean: 'ClassVar'?

Expected behavior

PyTest collects test(s), macro in code waits for connection from VS Code, debugging proceeds.

Steps to reproduce:

Use debugpy version 1.8.16 (downgrading to 1.8.15 fixed the problem), run a pytest for code that contains the debugpy code macro as I have below and wait a few seconds. The traceback will be reported and the wait_for_client() call will time out.

import debugpy
debugpy.listen(5679)
debugpy.wait_for_client()
主要言語
Python
スター
2.5k
フォーク
205
平均マージ
1日 3時間
マージ済み PR(30日)
5

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/debugpy のほかの issue

microsoft/debugpy の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。