diff options
author | Zachary Ware <zachary.ware@gmail.com> | 2016-09-05 22:32:28 (GMT) |
---|---|---|
committer | Zachary Ware <zachary.ware@gmail.com> | 2016-09-05 22:32:28 (GMT) |
commit | 625cb379f7e77457ca5be94e175d4b71a1d8989f (patch) | |
tree | 3175d098fdd598def14b4cbce5de2e1a603c60c5 /PC | |
parent | cefebf3cbe72b468bacc57c37f183712529058f9 (diff) | |
download | cpython-625cb379f7e77457ca5be94e175d4b71a1d8989f.zip cpython-625cb379f7e77457ca5be94e175d4b71a1d8989f.tar.gz cpython-625cb379f7e77457ca5be94e175d4b71a1d8989f.tar.bz2 |
Issue #25387: Check return value of winsound.MessageBeep
Diffstat (limited to 'PC')
-rw-r--r-- | PC/winsound.c | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/PC/winsound.c b/PC/winsound.c index 000ddd8..7e06b7b 100644 --- a/PC/winsound.c +++ b/PC/winsound.c @@ -175,7 +175,17 @@ static PyObject * winsound_MessageBeep_impl(PyObject *module, int x) /*[clinic end generated code: output=1ad89e4d8d30a957 input=a776c8a85c9853f6]*/ { - MessageBeep(x); + BOOL ok; + + Py_BEGIN_ALLOW_THREADS + ok = MessageBeep(x); + Py_END_ALLOW_THREADS + + if (!ok) { + PyErr_SetExcFromWindowsErr(PyExc_RuntimeError, 0); + return NULL; + } + Py_RETURN_NONE; } |