summaryrefslogtreecommitdiffstats
path: root/PC/clinic/winsound.c.h
diff options
context:
space:
mode:
Diffstat (limited to 'PC/clinic/winsound.c.h')
-rw-r--r--PC/clinic/winsound.c.h65
1 files changed, 55 insertions, 10 deletions
diff --git a/PC/clinic/winsound.c.h b/PC/clinic/winsound.c.h
index 86514f5..b37db4c 100644
--- a/PC/clinic/winsound.c.h
+++ b/PC/clinic/winsound.c.h
@@ -24,12 +24,23 @@ winsound_PlaySound(PyObject *module, PyObject *const *args, Py_ssize_t nargs, Py
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"sound", "flags", NULL};
- static _PyArg_Parser _parser = {"Oi:PlaySound", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "PlaySound", 0};
+ PyObject *argsbuf[2];
PyObject *sound;
int flags;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &sound, &flags)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ sound = args[0];
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ flags = _PyLong_AsInt(args[1]);
+ if (flags == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = winsound_PlaySound_impl(module, sound, flags);
@@ -61,12 +72,31 @@ winsound_Beep(PyObject *module, PyObject *const *args, Py_ssize_t nargs, PyObjec
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"frequency", "duration", NULL};
- static _PyArg_Parser _parser = {"ii:Beep", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "Beep", 0};
+ PyObject *argsbuf[2];
int frequency;
int duration;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &frequency, &duration)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 2, 2, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ frequency = _PyLong_AsInt(args[0]);
+ if (frequency == -1 && PyErr_Occurred()) {
+ goto exit;
+ }
+ if (PyFloat_Check(args[1])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ duration = _PyLong_AsInt(args[1]);
+ if (duration == -1 && PyErr_Occurred()) {
goto exit;
}
return_value = winsound_Beep_impl(module, frequency, duration);
@@ -94,16 +124,31 @@ winsound_MessageBeep(PyObject *module, PyObject *const *args, Py_ssize_t nargs,
{
PyObject *return_value = NULL;
static const char * const _keywords[] = {"type", NULL};
- static _PyArg_Parser _parser = {"|i:MessageBeep", _keywords, 0};
+ static _PyArg_Parser _parser = {NULL, _keywords, "MessageBeep", 0};
+ PyObject *argsbuf[1];
+ Py_ssize_t noptargs = nargs + (kwnames ? PyTuple_GET_SIZE(kwnames) : 0) - 0;
int type = MB_OK;
- if (!_PyArg_ParseStackAndKeywords(args, nargs, kwnames, &_parser,
- &type)) {
+ args = _PyArg_UnpackKeywords(args, nargs, NULL, kwnames, &_parser, 0, 1, 0, argsbuf);
+ if (!args) {
+ goto exit;
+ }
+ if (!noptargs) {
+ goto skip_optional_pos;
+ }
+ if (PyFloat_Check(args[0])) {
+ PyErr_SetString(PyExc_TypeError,
+ "integer argument expected, got float" );
+ goto exit;
+ }
+ type = _PyLong_AsInt(args[0]);
+ if (type == -1 && PyErr_Occurred()) {
goto exit;
}
+skip_optional_pos:
return_value = winsound_MessageBeep_impl(module, type);
exit:
return return_value;
}
-/*[clinic end generated code: output=19e5f0fb15bcd5bc input=a9049054013a1b77]*/
+/*[clinic end generated code: output=28d1cd033282723d input=a9049054013a1b77]*/