This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: sound_msgbeep doesn't check the return value of MessageBeep
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.6
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: Alexander Riccio, paul.moore, python-dev, steve.dower, tim.golden, zach.ware
Priority: normal Keywords: patch

Created on 2015-10-13 00:23 by Alexander Riccio, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
check_msgbeep_error.diff zach.ware, 2016-08-14 20:58 review
Messages (5)
msg252901 - (view) Author: Alexander Riccio (Alexander Riccio) * Date: 2015-10-13 00:30
A really minor issue (probably qualifies for the "easy" keyword):

sound_msgbeep (in doesn't check the return value of MessageBeep ( This is a very minor issue, but the possibility of failure is not mentioned in the winsound documentation. Invisible failures are quite surprising.

A message in the Gnome archives ( has an example "fix".
msg271949 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2016-08-04 04:28
Though the source link is incredibly out of date (we've been on for about 5 years now, and are soon to move to Github), this is a current issue.  The suggested 'example "fix"' is not applicable, though; in that case, MessageBeep is just used in preference to Beep, and falls back to Beep if MessageBeep fails.
msg272694 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2016-08-14 20:58
Here's a patch.  This has the possibility of breaking existing code, but the fix is simple (just catch RuntimeError) and is probably more in line with what's expected.
msg274451 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2016-09-05 22:33
New changeset 4e5b3dc049cc by Zachary Ware in branch 'default':
Issue #25387: Check return value of winsound.MessageBeep
msg274452 - (view) Author: Zachary Ware (zach.ware) * (Python committer) Date: 2016-09-05 22:34
I decided not to backport.  If anyone else would like to, I won't stand in their way.
Date User Action Args
2022-04-11 14:58:22adminsetgithub: 69574
2016-09-05 22:34:01zach.waresetstatus: open -> closed
versions: - Python 2.7, Python 3.5
messages: + msg274452

resolution: fixed
stage: patch review -> resolved
2016-09-05 22:33:09python-devsetnosy: + python-dev
messages: + msg274451
2016-08-14 20:58:49zach.waresetfiles: + check_msgbeep_error.diff
keywords: + patch
messages: + msg272694

stage: needs patch -> patch review
2016-08-04 04:28:26zach.waresetstage: needs patch
messages: + msg271949
versions: + Python 2.7, Python 3.5
2015-10-13 00:30:51Alexander Ricciosetnosy: paul.moore, tim.golden, zach.ware, steve.dower, Alexander Riccio
messages: + msg252901
2015-10-13 00:23:20Alexander Ricciocreate