python / python/mypy

stubgen: missing `__str__` method when the signature is different from default

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

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

bug topic-stubgen
主要言語
Python
スター
20.6k
フォーク
3.3k
平均マージ
1日 18時間
マージ済み PR(30日)
54

説明

Bug Report
When generating a stub with classes that define __str__ with extra parameters, __str__ is missing from the generated stub.

(A clear and concise description of what the bug is.)

To Reproduce

stubgen -p PyInstaller.utils.win32.versioninfo 

Expected Behavior

Classes in the generated PyInstaller.utils.win32.versioninfo stub should define def __str__(self, indent: str = "") -> str: ...

Actual Behavior
It's missing. Which results in a stubtest failure that has to be fixed manually.

Your Environment

  • Mypy version used: mypy 1.0.0 (compiled: yes)
  • Mypy command-line flags: N/A (stubgen, see above)
  • Mypy configuration options from mypy.ini (and other config files): N/A
  • Python version used: Python 3.9.13

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

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

はじめの一歩

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

調査の方向性

まず stubgen -p PyInstaller.utils.win32.versioninfo で問題を再現し、次に __str__ メソッドを処理する stubgen のエントリーポイントを追跡します。対象クラスの生成されたスタブに def __str__(self, indent: str = "") -> str: ... が含まれ、報告された stubtest の失敗を回避できれば完了です。

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

評価

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

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

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