summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-12-17 13:11:24 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-12-17 13:11:24 (GMT)
commit48d761e2b4b8cef40349aa286f6f46fc6c6d0fa7 (patch)
treec009c8128146dc5919a04caf26e9e97414fcd706 /Modules
parent87a854dc732ac3d2e64d8c2935bf1d77c8de5032 (diff)
downloadcpython-48d761e2b4b8cef40349aa286f6f46fc6c6d0fa7.zip
cpython-48d761e2b4b8cef40349aa286f6f46fc6c6d0fa7.tar.gz
cpython-48d761e2b4b8cef40349aa286f6f46fc6c6d0fa7.tar.bz2
Issue #16404: Add checks for return value of PyLong_FromLong() in
sys.getwindowsversion() and ossaudiodev.setparameters(). Reported by Ned Batchelder.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/ossaudiodev.c9
1 files changed, 1 insertions, 8 deletions
diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c
index 50e266f..817e204 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -561,7 +561,6 @@ oss_setparameters(oss_audio_t *self, PyObject *args)
{
int wanted_fmt, wanted_channels, wanted_rate, strict=0;
int fmt, channels, rate;
- PyObject * rv; /* return tuple (fmt, channels, rate) */
if (!_is_fd_valid(self->fd))
return NULL;
@@ -606,13 +605,7 @@ oss_setparameters(oss_audio_t *self, PyObject *args)
/* Construct the return value: a (fmt, channels, rate) tuple that
tells what the audio hardware was actually set to. */
- rv = PyTuple_New(3);
- if (rv == NULL)
- return NULL;
- PyTuple_SET_ITEM(rv, 0, PyLong_FromLong(fmt));
- PyTuple_SET_ITEM(rv, 1, PyLong_FromLong(channels));
- PyTuple_SET_ITEM(rv, 2, PyLong_FromLong(rate));
- return rv;
+ return Py_BuildValue("(iii)", fmt, channels, rate);
}
static int