typing.get_origin behaves differently between standard collections and typing collections

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

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

評価

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

調査の方向性

まず、レポートで説明されている dict、Dict、およびその他のコレクションの組み合わせについて typing.get_origin を再現します。既存の get_origin の実装とそのテストを読み、その後、互換性を壊す変更のリスクについての議論を確認します。意図した動作について合意され、関連するコレクションのケースが一貫してカバーされれば完了です。

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

説明

topic-typing type-bug

Bug report

typing.get_origin behaves differently between standard collections, and typing collections
more specifically

get_origin(dict) is None, while get_origin(Dict) is <class 'dict'>
the same holds for other collections as well

This is true from python3.9 where support for standard collections was added

to my understanding dict should be able to be a drop-in replacement for Dict, which is not true in case relying on get_origin

I suggest updating get_origin to return the relevant class for builtin collections as opposed to None which returns today

note, this might mean a breaking change, as pointed out here, but id does make Dict and dict behave more similarly

主要言語
Python
スター
77.2k
フォーク
36k
平均マージ
1日 9時間
マージ済み PR(30日)
558

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

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

はじめの一歩

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

python/cpython のほかの issue

python/cpython の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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