Improve wave module error messages to include the offending value
未關閉
還沒有人認領這個 Issue。
stdlib
type-feature
- 主要語言
- Python
- 星號
- 77.2k
- 分支
- 35.9k
- PR 合併指標
- PR 指標待擷取
描述
Summary
The wave module currently raises errors without the offending value:
wave.Error: bad # of channels
wave.Error: bad sample width
wave.Error: bad frame rate
When values come from variables, configuration, or parsed data, the
traceback shows the call site but not the actual offending value. For
Wave_read, the values are parsed from the WAV file header and never
appear in the traceback at all.
Reproduction
import wave, io
wave.open(io.BytesIO(), 'wb').setframerate(-1)
# wave.Error: bad frame rate
After this change:
wave.Error: bad frame rate: -1
I have a patch ready and will open a PR shortly.
Linked PRs
- gh-149307
貢獻指南
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
研究方向
從 wave 模組的驗證路徑開始,包括 setframerate(-1),以及 issue 中提到的 Wave_read 標頭解析。重現目前的錯誤,然後確認每則相關訊息都包含造成錯誤的值,並確認 wave 的現有行為維持不變。
由索引模型根據 Issue 內容生成。
評估
- 技術堆疊
- python
- 領域
- audio-video-rtc
- Issue 類型
- 缺陷
- 難度
- 2/5
- 預估耗時
- 1-3 小時
- 活躍度
- 停滯
- 描述清晰度
- 描述清楚
- 新手友好度
- 25/100