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.

classification
Title: sound_msgbeep doesn't check the return value of MessageBeep
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.6
process
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.

Files
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 http://svn.python.org/projects/python/trunk/PC/winsound.c) doesn't check the return value of MessageBeep (https://msdn.microsoft.com/en-us/library/windows/desktop/ms680356.aspx). 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 (https://mail.gnome.org/archives/commits-list/2010-November/msg01938.html) 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 hg.python.org 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
https://hg.python.org/cpython/rev/4e5b3dc049cc
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.
History
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