diff --git a/Modules/ossaudiodev.c b/Modules/ossaudiodev.c index b0a16dbf0d7..be900163470 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 diff --git a/Python/sysmodule.c b/Python/sysmodule.c index 46a6aa9ec21..d238561ecdb 100644 --- a/Python/sysmodule.c +++ b/Python/sysmodule.c @@ -801,6 +801,10 @@ sys_getwindowsversion(PyObject *self) PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wSuiteMask)); PyStructSequence_SET_ITEM(version, pos++, PyLong_FromLong(ver.wProductType)); + if (PyErr_Occurred()) { + Py_DECREF(version); + return NULL; + } return version; }