python / python/mypy

Conditional deduction support with comparison of `sys.hexversion` against integer literal

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

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

feature
主要言語
Python
スター
20.6k
フォーク
3.3k
PR マージ指標
PR 指標を取得中

説明

Feature

Currently, mypy statically evaluates some if branches involving only sys.version_info and sys.platform as always false based on the version and platform it is running on. I propose to have it recognize comparisons against sys.hexversion as well.

Pitch

Some specialized functions targeting bugs patched in a certain alpha, beta or release candidate or internal behavioural differences between patch versions would need this functionality. Also, it may be desirable to give alpha/beta/rc versions a grace period for certain small deprecations, only raising an error on their use in the final python release. Implementation-wise, because the exact value of hexversion can be easily retrieved, and sys.platform and sys.version_info have set precedents, I do not believe it would be unreasonably hard to implement.

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

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

はじめの一歩

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

調査の方向性

まず、sys.version_info と sys.platform に関係する条件に対する mypy の既存の静的評価を見つけます。バージョン比較がどのように表現され、テストされているかを追跡し、次に sys.hexversion と整数リテラルの比較で期待される動作を判断します。既存のケースと一貫した形でサポート対象の hexversion 条件が評価され、要求された比較をカバーするテストがあれば完了です。

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

評価

技術スタック
python
領域
devtools
issue の種類
機能追加
難易度
4/5
見積もり時間
3〜5日
活発さ
静か
明瞭さ
おおむね明確
初心者へのやさしさ
48/100

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

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