Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sound_msgbeep doesn't check the return value of MessageBeep #69574

Closed
ariccio mannequin opened this issue Oct 13, 2015 · 5 comments
Closed

sound_msgbeep doesn't check the return value of MessageBeep #69574

ariccio mannequin opened this issue Oct 13, 2015 · 5 comments
Labels
OS-windows type-bug An unexpected behavior, bug, or error

Comments

@ariccio
Copy link
Mannequin

ariccio mannequin commented Oct 13, 2015

BPO 25387
Nosy @pfmoore, @tjguk, @zware, @zooba, @ariccio
Files
  • check_msgbeep_error.diff
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2016-09-05.22:34:01.938>
    created_at = <Date 2015-10-13.00:23:20.491>
    labels = ['type-bug', 'OS-windows']
    title = "sound_msgbeep doesn't check the return value of MessageBeep"
    updated_at = <Date 2016-09-05.22:34:01.937>
    user = 'https://github.com/ariccio'

    bugs.python.org fields:

    activity = <Date 2016-09-05.22:34:01.937>
    actor = 'zach.ware'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-09-05.22:34:01.938>
    closer = 'zach.ware'
    components = ['Windows']
    creation = <Date 2015-10-13.00:23:20.491>
    creator = 'Alexander Riccio'
    dependencies = []
    files = ['44106']
    hgrepos = []
    issue_num = 25387
    keywords = ['patch']
    message_count = 5.0
    messages = ['252901', '271949', '272694', '274451', '274452']
    nosy_count = 6.0
    nosy_names = ['paul.moore', 'tim.golden', 'python-dev', 'zach.ware', 'steve.dower', 'Alexander Riccio']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'behavior'
    url = 'https://bugs.python.org/issue25387'
    versions = ['Python 3.6']

    @ariccio ariccio mannequin added OS-windows type-bug An unexpected behavior, bug, or error labels Oct 13, 2015
    @ariccio
    Copy link
    Mannequin Author

    ariccio mannequin commented Oct 13, 2015

    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".

    @zware
    Copy link
    Member

    zware commented Aug 4, 2016

    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.

    @zware
    Copy link
    Member

    zware commented Aug 14, 2016

    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.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Sep 5, 2016

    New changeset 4e5b3dc049cc by Zachary Ware in branch 'default':
    Issue bpo-25387: Check return value of winsound.MessageBeep
    https://hg.python.org/cpython/rev/4e5b3dc049cc

    @zware
    Copy link
    Member

    zware commented Sep 5, 2016

    I decided not to backport. If anyone else would like to, I won't stand in their way.

    @zware zware closed this as completed Sep 5, 2016
    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    OS-windows type-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant