FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

gh-144975: Fix wave.Wave_write.setframerate() validation order by mbeijen · Pull Request #144976 · python/cpython · GitHub

Repository navigation

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

Merged
encukou merged 3 commits into
python:mainfrom
mbeijen:wave-setframerate
Mar 17, 2026
Merged

encukou merged 3 commits into
python:mainfrom
mbeijen:wave-setframerate

Conversation

mbeijen commented Feb 18, 2026 •
edited by bedevere-app Bot
Loading

Copy link
Copy Markdown
Contributor

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.

encukou left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Thank you!

I pushed a commit directly: We have a little helper to "parametrize" tests, so that the first failure doesn't mask the rest.

Do the tests look good to you?

mbeijen commented Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

Thank you!

I pushed a commit directly: We have a little helper to "parametrize" tests, so that the first failure doesn't mask the rest.

Do the tests look good to you?

Elegant, thanks!!!

encukou merged commit ff287a7 into python:main Mar 17, 2026
51 checks passed
ljfp pushed a commit to ljfp/cpython that referenced this pull request Apr 25, 2026
…ythonGH-144976)

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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL