Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

false alarm on decode call

未關閉 適合新手
#16,441 1 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

維護者通常 1 天內回覆

@jw9829 已經在處理了。

開始於 2026年9月27日。

  • #16446 來自 @jw9829 —— 已關閉,未合併
  • #16447 來自 @jw9829 —— 未關閉

評估

難度
2/5
預估耗時
1-3 小時
新手友好度
76/100
Issue 類型
缺陷
描述清晰度
描述清楚
活躍度
活躍
技術堆疊
python
領域
devtools

研究方向

先檢查診斷中參照的 codecs 定義,然後使用 mypy 重現提供的 lookup/decode 範例。當帶有 errors="replace" 的有效呼叫不會產生 unexpected-keyword 錯誤,同時其他 codecs 的型別檢查仍由現有檢查涵蓋時,工作即完成。

由索引模型根據 Issue 內容生成。

描述

help wanted stubs: false positive

Bug Report

The following file is legal python, as far as I understand it:

import codecs

a = codecs.lookup("UTF-8")
b = bytes(b"potato")
c = a.decode(b, errors="replace")

Running mypy 2.3.1 produces:

$ mypy wibble.py
wibble.py:5: error: Unexpected keyword argument "errors" for "__call__" of "_Decoder"  [call-arg]
wibble.py:5: note: "__call__" defined in "codecs"

To Reproduce

https://mypy-play.net/?mypy=latest&python=latest&gist=e34d60fa6ddb3835c9d2dae7eae7a301

Expected Behavior

I would expect no message at all. Reasoning:

Actual Behavior

False alarm is issued.

Your Environment

  • Mypy version used: 2.3.1
  • Mypy command-line flags: none
  • Mypy configuration options from mypy.ini (and other config files): none
  • Python version used: 2.13.5 (from Debian trixie)
主要語言
Python
星號
5.1k
分支
2.1k
平均合併
1 天 19 小時
30 天內合併 PR
75

環境準備

  • 沒有 Dockerfile 或 Docker Compose 檔案
  • 沒有 Pull Request 範本
  • 閱讀貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

python/typeshed 的其他 Issue

查看 python/typeshed 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。