Recognize platform.system() as well as sys.platform
オープン
まだ誰も着手していません。
feature
good-second-issue
priority-1-normal
topic-runtime-semantics
- 主要言語
- Python
- スター
- 20.6k
- フォーク
- 3.3k
- PR マージ指標
- PR 指標を取得中
説明
Note: if you are reporting a wrong signature of a function or a class in
the standard library, then the typeshed tracker is better suited
for this report: https://github.com/python/typeshed/issues
Please provide more information to help us understand the issue:
- Are you reporting a bug, or opening a feature request? feature request
- Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
if platform.system() != "Windows": # sys.platform != "win32":
try:
# os.confstr("CS_GNU_LIBC_VERSION") returns a string like "glibc 2.17".
version_string = os.confstr("CS_GNU_LIBC_VERSION")
assert version_string is not None
_, version = version_string.split()
except (AssertionError, OSError, ValueError):
# os.confstr() or CS_GNU_LIBC_VERSION not available (or a bad value)...
return None
return version
return None
- What is the actual behavior/output? "error: Module has no attribute "confstr""
- What is the behavior/output you expect? No error when run under Windows
- What are the versions of mypy and Python you are using? mypy 0.750, Python 3.7.4
Basically it would be nice to get to use platform.system() instead of having to use sys.platform to make mypy happy with code that is conditional on the platform.
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
提供された Python repro から始め、条件分岐コードで mypy が platform.system() と sys.platform をどのように扱うか比較してください。プラットフォーム固有の解析エントリーポイントを特定し、Windows ブランチで os.confstr が見つからないものとして報告されないことを確認して変更を検証してください。payload にはソースファイルもテストも指定されていません。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- python
- 領域
- devtools
- issue の種類
- 機能追加
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 38/100