Skip to content

gh-144975: Fix wave.Wave_write.setframerate() validation order#144976

Open
mbeijen wants to merge 2 commits intopython:mainfrom
mbeijen:wave-setframerate
Open

gh-144975: Fix wave.Wave_write.setframerate() validation order#144976
mbeijen wants to merge 2 commits intopython:mainfrom
mbeijen:wave-setframerate

Conversation

@mbeijen
Copy link
Contributor

@mbeijen mbeijen commented Feb 18, 2026

Validate the frame rate after rounding to an integer, not before. This prevents values like 0.5 from passing validation (0.5 > 0) but then rounding to 0, which would cause a confusing delayed error "sampling rate not specified" when writing frames.

With this fix, setframerate(0.5) immediately raises "bad frame rate", providing clear feedback at the point of the error.

See #144975

Validate the frame rate after rounding to an integer, not before.
This prevents values like 0.5 from passing validation (0.5 > 0)
but then rounding to 0, which would cause a confusing delayed error
"sampling rate not specified" when writing frames.

With this fix, setframerate(0.5) immediately raises "bad frame rate",
providing clear feedback at the point of the error.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments