You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
wave.open raises EOFError instead of wave.Error for a truncated fmt chunk #153692
wave.open(f, 'rb') is documented to raise wave.Error when a file violates
the WAV format, but it leaks a raw EOFError when the fmt chunk is truncated
(the chunk header declares 16 bytes but fewer are present):
Expected: wave.Error. Wave_read._read_fmt_chunk() raises EOFError on a
short read, but Wave_read.initfp() does not wrap that call, so it escapes the
public API. Every other malformed-input path in the module raises wave.Error.
This is a deliberate choice rather than an oversight. The EOFError comes from 134cb01 (bpo-32056, GH-5951), which converted struct.error to EOFError for a truncated chunk while raising Error for invalid content in the very same commit (unknown format, bad sample width, bad # of channels). Truncation and malformed contents were separated on purpose.
Activity
pythongh-153692: Fix the NEWS inline literal (drop trailing space in …
serhiy-storchaka commentedon Aug 17, 2026
This is a deliberate choice rather than an oversight. The
EOFErrorcomes from 134cb01 (bpo-32056, GH-5951), which convertedstruct.errortoEOFErrorfor a truncated chunk while raisingErrorfor invalid content in the very same commit (unknown format, bad sample width, bad # of channels). Truncation and malformed contents were separated on purpose.