summaryrefslogtreecommitdiff
path: root/Modules
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-12-17 15:12:46 +0200
committerSerhiy Storchaka <storchaka@gmail.com>2013-12-17 15:12:46 +0200
commit5ea4e6a0110ad1fb783cbff7edb260907fa32403 (patch)
tree888b8b59894e05c36b5160d4422534dd4f96d882 /Modules
parent3b6c9aa09199408e09ca13802cdef3b2a301f093 (diff)
parent93ca9bf32ba707d3d1d763292c6652e1c1135bb6 (diff)
downloadcpython-5ea4e6a0110ad1fb783cbff7edb260907fa32403.tar.gz
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 b0a16dbf0d..be90016347 100644
--- a/Modules/ossaudiodev.c
+++ b/Modules/ossaudiodev.c
@@ -564,7 +564,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;
@@ -609,13 +608,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