aboutsummaryrefslogtreecommitdiff
path: root/PC/clinic
diff options
context:
space:
mode:
authorZachary Ware <zachary.ware@gmail.com>2016-09-06 16:32:43 -0500
committerZachary Ware <zachary.ware@gmail.com>2016-09-06 16:32:43 -0500
commitc401881d689b2ca89211a6ff2cd5ac96150d237d (patch)
tree49045f3371cd68e0542ea1d57d1b4eba70de3d98 /PC/clinic
parentimprove grammar (diff)
downloadcpython-c401881d689b2ca89211a6ff2cd5ac96150d237d.tar.gz
cpython-c401881d689b2ca89211a6ff2cd5ac96150d237d.tar.bz2
cpython-c401881d689b2ca89211a6ff2cd5ac96150d237d.zip
Closes #27982: Allow keyword arguments to winsound functions
Diffstat (limited to 'PC/clinic')
-rw-r--r--PC/clinic/winsound.c.h40
1 files changed, 23 insertions, 17 deletions
diff --git a/PC/clinic/winsound.c.h b/PC/clinic/winsound.c.h
index a4c393856f5..766479ada2d 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]*/