python / python/mypy

(🐞) platform specified in inline configuration results in wacky behavior

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

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

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

説明

It seems like even though this is not a per module option, it is still being applied to the module, but it's using the global(linux) type defs.

import sys, winreg

if sys.platform == "win32":
    winreg.QueryValueEx

# Success: no issues found in 1 source file
# mypy: platform=win32
import sys, winreg

if sys.platform == "win32":
    winreg.QueryValueEx  # test.py:5:5: error: Module has no attribute "QueryValueEx"  [attr-defined]

playground

  • Relates to: #12342

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

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

はじめの一歩

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

調査の方向性

提供されている mypy-play の再現例から始め、インライン設定 # mypy: platform=win32 が同等のグローバルなプラットフォーム設定とどのように処理されるかを比較します。インラインオプションがあるにもかかわらず、モジュールが Linux の型定義を使用する理由を確認します。完了条件は、インライン設定で保護された winreg.QueryValueEx 参照が受け入れられ、例を対象とするリグレッションテストがあることです。

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

評価

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

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

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