From a397e56d2aad76fe5cacd54a2ecbdb03702985c7 Mon Sep 17 00:00:00 2001 From: Serhiy Storchaka Date: Thu, 9 Jun 2016 16:16:06 +0300 Subject: Issue #26305: Argument Clinic now uses braces in C code as required by PEP 7. --- PC/clinic/winsound.c.h | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'PC/clinic/winsound.c.h') diff --git a/PC/clinic/winsound.c.h b/PC/clinic/winsound.c.h index dca5a429f3..e649363fe2 100644 --- a/PC/clinic/winsound.c.h +++ b/PC/clinic/winsound.c.h @@ -27,8 +27,9 @@ winsound_PlaySound(PyModuleDef *module, PyObject *args) int flags; if (!PyArg_ParseTuple(args, "Zi:PlaySound", - &sound, &flags)) + &sound, &flags)) { goto exit; + } return_value = winsound_PlaySound_impl(module, sound, flags); exit: @@ -61,8 +62,9 @@ winsound_Beep(PyModuleDef *module, PyObject *args) int duration; if (!PyArg_ParseTuple(args, "ii:Beep", - &frequency, &duration)) + &frequency, &duration)) { goto exit; + } return_value = winsound_Beep_impl(module, frequency, duration); exit: @@ -90,11 +92,12 @@ winsound_MessageBeep(PyModuleDef *module, PyObject *args) int x = MB_OK; if (!PyArg_ParseTuple(args, "|i:MessageBeep", - &x)) + &x)) { goto exit; + } return_value = winsound_MessageBeep_impl(module, x); exit: return return_value; } -/*[clinic end generated code: output=c5b018ac9dc1f500 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=a5f53e42d4396bb4 input=a9049054013a1b77]*/ -- cgit v1.2.1 From d4c6b44f0689ed5f7f98eed08bcaeb3a8cb164bc Mon Sep 17 00:00:00 2001 From: Zachary Ware Date: Mon, 5 Sep 2016 16:31:21 -0500 Subject: Closes #11620: Fix support for SND_MEMORY in winsound.PlaySound. Based on a patch by Tim Lesher. --- PC/clinic/winsound.c.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'PC/clinic/winsound.c.h') diff --git a/PC/clinic/winsound.c.h b/PC/clinic/winsound.c.h index cdb20454a5..a4c393856f 100644 --- a/PC/clinic/winsound.c.h +++ b/PC/clinic/winsound.c.h @@ -17,16 +17,16 @@ PyDoc_STRVAR(winsound_PlaySound__doc__, {"PlaySound", (PyCFunction)winsound_PlaySound, METH_VARARGS, winsound_PlaySound__doc__}, static PyObject * -winsound_PlaySound_impl(PyObject *module, Py_UNICODE *sound, int flags); +winsound_PlaySound_impl(PyObject *module, PyObject *sound, int flags); static PyObject * winsound_PlaySound(PyObject *module, PyObject *args) { PyObject *return_value = NULL; - Py_UNICODE *sound; + PyObject *sound; int flags; - if (!PyArg_ParseTuple(args, "Zi:PlaySound", + if (!PyArg_ParseTuple(args, "Oi:PlaySound", &sound, &flags)) { goto exit; } @@ -100,4 +100,4 @@ winsound_MessageBeep(PyObject *module, PyObject *args) exit: return return_value; } -/*[clinic end generated code: output=1044b2adf3c67014 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=b999334e2e444ad2 input=a9049054013a1b77]*/ -- cgit v1.2.1 From 1b330a040ac363eea07d1e0e0c4dc8b1f4d8b02c Mon Sep 17 00:00:00 2001 From: Zachary Ware Date: Tue, 6 Sep 2016 16:32:43 -0500 Subject: Closes #27982: Allow keyword arguments to winsound functions --- PC/clinic/winsound.c.h | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) (limited to 'PC/clinic/winsound.c.h') diff --git a/PC/clinic/winsound.c.h b/PC/clinic/winsound.c.h index a4c393856f..766479ada2 100644 --- a/PC/clinic/winsound.c.h +++ b/PC/clinic/winsound.c.h @@ -3,7 +3,7 @@ preserve [clinic start generated code]*/ PyDoc_STRVAR(winsound_PlaySound__doc__, -"PlaySound($module, sound, flags, /)\n" +"PlaySound($module, /, sound, flags)\n" "--\n" "\n" "A wrapper around the Windows PlaySound API.\n" @@ -14,19 +14,21 @@ PyDoc_STRVAR(winsound_PlaySound__doc__, " Flag values, ored together. See module documentation."); #define WINSOUND_PLAYSOUND_METHODDEF \ - {"PlaySound", (PyCFunction)winsound_PlaySound, METH_VARARGS, winsound_PlaySound__doc__}, + {"PlaySound", (PyCFunction)winsound_PlaySound, METH_VARARGS|METH_KEYWORDS, winsound_PlaySound__doc__}, static PyObject * winsound_PlaySound_impl(PyObject *module, PyObject *sound, int flags); static PyObject * -winsound_PlaySound(PyObject *module, PyObject *args) +winsound_PlaySound(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; + static const char * const _keywords[] = {"sound", "flags", NULL}; + static _PyArg_Parser _parser = {"Oi:PlaySound", _keywords, 0}; PyObject *sound; int flags; - if (!PyArg_ParseTuple(args, "Oi:PlaySound", + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &sound, &flags)) { goto exit; } @@ -37,7 +39,7 @@ exit: } PyDoc_STRVAR(winsound_Beep__doc__, -"Beep($module, frequency, duration, /)\n" +"Beep($module, /, frequency, duration)\n" "--\n" "\n" "A wrapper around the Windows Beep API.\n" @@ -49,19 +51,21 @@ PyDoc_STRVAR(winsound_Beep__doc__, " How long the sound should play, in milliseconds."); #define WINSOUND_BEEP_METHODDEF \ - {"Beep", (PyCFunction)winsound_Beep, METH_VARARGS, winsound_Beep__doc__}, + {"Beep", (PyCFunction)winsound_Beep, METH_VARARGS|METH_KEYWORDS, winsound_Beep__doc__}, static PyObject * winsound_Beep_impl(PyObject *module, int frequency, int duration); static PyObject * -winsound_Beep(PyObject *module, PyObject *args) +winsound_Beep(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; + static const char * const _keywords[] = {"frequency", "duration", NULL}; + static _PyArg_Parser _parser = {"ii:Beep", _keywords, 0}; int frequency; int duration; - if (!PyArg_ParseTuple(args, "ii:Beep", + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, &frequency, &duration)) { goto exit; } @@ -72,7 +76,7 @@ exit: } PyDoc_STRVAR(winsound_MessageBeep__doc__, -"MessageBeep($module, x=MB_OK, /)\n" +"MessageBeep($module, /, type=MB_OK)\n" "--\n" "\n" "Call Windows MessageBeep(x).\n" @@ -80,24 +84,26 @@ PyDoc_STRVAR(winsound_MessageBeep__doc__, "x defaults to MB_OK."); #define WINSOUND_MESSAGEBEEP_METHODDEF \ - {"MessageBeep", (PyCFunction)winsound_MessageBeep, METH_VARARGS, winsound_MessageBeep__doc__}, + {"MessageBeep", (PyCFunction)winsound_MessageBeep, METH_VARARGS|METH_KEYWORDS, winsound_MessageBeep__doc__}, static PyObject * -winsound_MessageBeep_impl(PyObject *module, int x); +winsound_MessageBeep_impl(PyObject *module, int type); static PyObject * -winsound_MessageBeep(PyObject *module, PyObject *args) +winsound_MessageBeep(PyObject *module, PyObject *args, PyObject *kwargs) { PyObject *return_value = NULL; - int x = MB_OK; + static const char * const _keywords[] = {"type", NULL}; + static _PyArg_Parser _parser = {"|i:MessageBeep", _keywords, 0}; + int type = MB_OK; - if (!PyArg_ParseTuple(args, "|i:MessageBeep", - &x)) { + if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + &type)) { goto exit; } - return_value = winsound_MessageBeep_impl(module, x); + return_value = winsound_MessageBeep_impl(module, type); exit: return return_value; } -/*[clinic end generated code: output=b999334e2e444ad2 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=40b3d3ef2faefb15 input=a9049054013a1b77]*/ -- cgit v1.2.1 From daa2ed44798ad45ac665321cae21a23661d0e044 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Fri, 9 Sep 2016 20:00:13 -0700 Subject: Issue #27810: Rerun Argument Clinic on all modules --- PC/clinic/winsound.c.h | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'PC/clinic/winsound.c.h') diff --git a/PC/clinic/winsound.c.h b/PC/clinic/winsound.c.h index 766479ada2..52d25b2434 100644 --- a/PC/clinic/winsound.c.h +++ b/PC/clinic/winsound.c.h @@ -14,13 +14,13 @@ PyDoc_STRVAR(winsound_PlaySound__doc__, " Flag values, ored together. See module documentation."); #define WINSOUND_PLAYSOUND_METHODDEF \ - {"PlaySound", (PyCFunction)winsound_PlaySound, METH_VARARGS|METH_KEYWORDS, winsound_PlaySound__doc__}, + {"PlaySound", (PyCFunction)winsound_PlaySound, METH_FASTCALL, winsound_PlaySound__doc__}, static PyObject * winsound_PlaySound_impl(PyObject *module, PyObject *sound, int flags); static PyObject * -winsound_PlaySound(PyObject *module, PyObject *args, PyObject *kwargs) +winsound_PlaySound(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"sound", "flags", NULL}; @@ -28,7 +28,7 @@ winsound_PlaySound(PyObject *module, PyObject *args, PyObject *kwargs) PyObject *sound; int flags; - if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, &sound, &flags)) { goto exit; } @@ -51,13 +51,13 @@ PyDoc_STRVAR(winsound_Beep__doc__, " How long the sound should play, in milliseconds."); #define WINSOUND_BEEP_METHODDEF \ - {"Beep", (PyCFunction)winsound_Beep, METH_VARARGS|METH_KEYWORDS, winsound_Beep__doc__}, + {"Beep", (PyCFunction)winsound_Beep, METH_FASTCALL, winsound_Beep__doc__}, static PyObject * winsound_Beep_impl(PyObject *module, int frequency, int duration); static PyObject * -winsound_Beep(PyObject *module, PyObject *args, PyObject *kwargs) +winsound_Beep(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"frequency", "duration", NULL}; @@ -65,7 +65,7 @@ winsound_Beep(PyObject *module, PyObject *args, PyObject *kwargs) int frequency; int duration; - if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, &frequency, &duration)) { goto exit; } @@ -84,20 +84,20 @@ PyDoc_STRVAR(winsound_MessageBeep__doc__, "x defaults to MB_OK."); #define WINSOUND_MESSAGEBEEP_METHODDEF \ - {"MessageBeep", (PyCFunction)winsound_MessageBeep, METH_VARARGS|METH_KEYWORDS, winsound_MessageBeep__doc__}, + {"MessageBeep", (PyCFunction)winsound_MessageBeep, METH_FASTCALL, winsound_MessageBeep__doc__}, static PyObject * winsound_MessageBeep_impl(PyObject *module, int type); static PyObject * -winsound_MessageBeep(PyObject *module, PyObject *args, PyObject *kwargs) +winsound_MessageBeep(PyObject *module, PyObject **args, Py_ssize_t nargs, PyObject *kwnames) { PyObject *return_value = NULL; static const char * const _keywords[] = {"type", NULL}; static _PyArg_Parser _parser = {"|i:MessageBeep", _keywords, 0}; int type = MB_OK; - if (!_PyArg_ParseTupleAndKeywordsFast(args, kwargs, &_parser, + if (!_PyArg_ParseStack(args, nargs, kwnames, &_parser, &type)) { goto exit; } @@ -106,4 +106,4 @@ winsound_MessageBeep(PyObject *module, PyObject *args, PyObject *kwargs) exit: return return_value; } -/*[clinic end generated code: output=40b3d3ef2faefb15 input=a9049054013a1b77]*/ +/*[clinic end generated code: output=bfe16b2b8b490cb1 input=a9049054013a1b77]*/ -- cgit v1.2.1