wave.Wave_write.setparams() rejects valid PCM-to-IEEE-float parameter changes
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
調査の方向性
The issue identifies Lib/wave.py, specifically Wave_write.setparams(), setformat(), and setsampwidth(). Read those methods and the tests for IEEE float support, then reproduce the PCM-to-float reconfiguration case from the report. Done means valid 4-byte and 8-byte float parameters can be set before any frames are written, including after PCM widths of 1, 2, or 3 bytes.
索引モデルが issue の本文から書いたものです。
説明
Bug report
Bug description
wave.Wave_write.setparams() rejects valid IEEE-float parameters when the writer was previously configured with a PCM sample width of 1, 2, or 3 bytes, even though no audio frames have been written.
The same parameters succeed on a fresh writer.
Reproducer
import io
import wave
float_params = (
1, 4, 8000, 0, "NONE", "not compressed",
wave.WAVE_FORMAT_IEEE_FLOAT,
)
with wave.open(io.BytesIO(), "wb") as writer:
writer.setparams(float_params)
print("Fresh writer: OK")
with wave.open(io.BytesIO(), "wb") as writer:
writer.setparams((1, 2, 8000, 0, "NONE", "not compressed"))
writer.setparams(float_params)
print("Reconfigured writer: OK")
Actual behavior
The fresh-writer configuration succeeds. Reconfiguring the PCM writer raises:
wave.Error: unsupported sample width for IEEE float format
Expected behavior
Both configurations should succeed. The new sample width is 4 bytes, which is supported for IEEE float, and no frames have been written.
Implementation details
Wave_write.setparams() calls setformat(format) before
setsampwidth(sampwidth).
However, setformat() validates the existing self._sampwidth against the
new format. This rejects the previous 2-byte PCM width before the valid
new 4-byte width can be installed.
The same failure occurs when switching from PCM widths of 1, 2, or 3 bytes
to either 4-byte or 8-byte IEEE float. Switching from 4-byte PCM succeeds.
Related: #60729 added IEEE-float support.
CPython versions tested on
Python 3.16.0a1+dev, debug build based on commit 8b7d6c53eee.
Also reproduced using Lib/wave.py from upstream commit
f5bd07700ecd0f02cc424666b871f51de03b9232, executed under Python 3.14.8.
This additional check was not a full build of that upstream commit.
Operating systems tested on
macOS
Output from running python -VV
Python 3.16.0a1+dev (heads/gh-159868-userstring-affixes-dirty:8b7d6c53eee, Oct 20 2026, 15:46:41) [Clang 21.0.0 (clang-2100.3.34.2)]
CPython versions tested on:
3.16
Operating systems tested on:
macOS
Linked PRs
- gh-160031
- 主要言語
- Python
- スター
- 77.7k
- フォーク
- 38.3k
- 平均マージ
- 13時間 30分
- マージ済み PR(30日)
- 708
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
python/cpython のほかの issue
-
tarfile: extractfile(member).read() of a sparse member is slow due to repeated bytes concatenationオープンperformance stdlib
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
メンテナーはふだん 1 日以内に返信
-
tests topic-profiling type-bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
python/cpython#160334 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
`iso2022_jp_3` encodes U+9B1D but decodes the result as U+9B1C対応中かも @kinqsradio が 1 日前に担当しました。 オープンextension-modules type-bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
メンテナーはふだん 1 日以内に返信
-
interpreter-core type-feature
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
python/cpython#160109 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
extension-modules type-bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
python/cpython#160001 · コメント 3 件 ·
メンテナーはふだん 1 日以内に返信
似ている issue
-
filesystem: `file://C:/...` bucket_url is read as a UNC share named `C:` and silently lists no filesオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
comp/desktop desktop/shell os/windows P3 tool/file type/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
NousResearch/hermes-agent#145928 ·
メンテナーはふだん 1 日以内に返信
-
integration:coding-agents
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
vectorize-io/hindsight#6151 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
FormalLanguageConstrainedPathQuerying/FLPQ_Data#174 ·
メンテナーはふだん 1 日以内に返信
-
[VLM] granite_vision preset produces empty output and runs ~3× slower with Granite Vision 3.3-2B than with Granite Vision 4.1-4B対応中かも @prassu017 が今日担当しました。 オープンbug
難易度 2/5 1〜3時間 初心者へのやさしさ 74/100
docling-project/docling#5068 · コメント 4 件 ·
メンテナーはふだん 1 日以内に返信