python / python/mypy

Assertion failure crash: assert not self.has_type_var_tuple_type

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

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

crash topic-pep-646 topic-pep-695
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

Crash Report

The snippet below crashes mypy 1.19.1 and master (c41dbd0). The crash seems similar to #20287.

Traceback

Traceback (most recent call last):
  File ".venv-mypy/bin/mypy", line 7, in <module>
    sys.exit(console_entry())
  File "mypy/mypy/__main__.py", line 15, in console_entry
    main()
  File "mypy/mypy/main.py", line 135, in main
    res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
  File "mypy/mypy/main.py", line 219, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "mypy/mypy/build.py", line 320, in build
    result = build_inner(
  File "mypy/mypy/build.py", line 417, in build_inner
    graph = dispatch(sources, manager, stdout)
  File "mypy/mypy/build.py", line 3178, in dispatch
    process_graph(graph, manager)
  File "mypy/mypy/build.py", line 3588, in process_graph
    done, still_working, results = manager.wait_for_done(graph)
  File "mypy/mypy/build.py", line 1070, in wait_for_done
    process_stale_scc(graph, next_scc, self)
  File "mypy/mypy/build.py", line 3745, in process_stale_scc
    mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
  File "mypy/mypy/semanal_main.py", line 94, in semantic_analysis_for_scc
    process_top_levels(graph, scc, patches)
  File "mypy/mypy/semanal_main.py", line 232, in process_top_levels
    deferred, incomplete, progress = semantic_analyze_target(
  File "mypy/mypy/semanal_main.py", line 409, in semantic_analyze_target
    analyzer.refresh_partial(
  File "mypy/mypy/semanal.py", line 703, in refresh_partial
    self.refresh_top_level(node)
  File "mypy/mypy/semanal.py", line 721, in refresh_top_level
    self.accept(d)
  File "mypy/mypy/semanal.py", line 7598, in accept
    node.accept(self)
    ~~~~~~~~~~~^^^^^^
  File "mypy/mypy/nodes.py", line 1487, in accept
    return visitor.visit_class_def(self)
           ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "mypy/mypy/semanal.py", line 1829, in visit_class_def
    self.analyze_class(defn)
    ~~~~~~~~~~~~~~~~~~^^^^^^
  File "mypy/mypy/semanal.py", line 2023, in analyze_class
    self.setup_type_vars(defn, tvar_defs)
    ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
  File "mypy/mypy/semanal.py", line 2065, in setup_type_vars
    defn.info.add_type_vars()
    ~~~~~~~~~~~~~~~~~~~~~~~^^
  File "mypy/mypy/nodes.py", line 3620, in add_type_vars
    assert not self.has_type_var_tuple_type
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError: 

To Reproduce

class C[*T, *U](T, U):
    pass

Your Environment

  • Mypy version used: c41dbd0 (and 1.19.1)
  • Mypy command-line flags: N/A
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: 3.13.11
  • Operating system and version: Arch Linux

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

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

調査の方向性

提供されたクラス定義を使い、mypy 1.19.1 または master でクラッシュを再現します。mypy/nodes.py の add_type_vars から開始し、mypy/semanal.py の setup_type_vars を通じてその呼び出し元をたどります。この入力に対して assertion が mypy をクラッシュさせなくなり、回帰テストのカバレッジによって修正が保護されれば完了です。

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

評価

技術スタック
python
領域
devtools
issue の種類
バグ
難易度
3/5
見積もり時間
1〜2日
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
55/100

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

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