Issue 25387: sound_msgbeep doesn't check the return value of MessageBeep (original) (raw)

Issue25387

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:22 admin set github: 69574
2016-09-05 22:34:01 zach.ware set status: open -> closedversions: - Python 2.7, Python 3.5messages: + resolution: fixedstage: patch review -> resolved
2016-09-05 22:33:09 python-dev set nosy: + python-devmessages: +
2016-08-14 20:58:49 zach.ware set files: + check_msgbeep_error.diffkeywords: + patchmessages: + stage: needs patch -> patch review
2016-08-04 04:28:26 zach.ware set stage: needs patchmessages: + versions: + Python 2.7, Python 3.5
2015-10-13 00:30:51 Alexander Riccio set nosy:paul.moore, tim.golden, zach.ware, steve.dower, Alexander Ricciomessages: +
2015-10-13 00:23:20 Alexander Riccio create