mirror of
https://github.com/larsimmisch/pyalsaaudio.git
synced 2026-04-16 16:15:31 +00:00
fix return value of PCM.write() on success (#137)
the `else` branch of the return value handling cascade got lost in
commit 438e52e, leading to us returning None on success.
rather than restoring the old code exactly, delay the construction
of the final return code object. this is more consistent with
alsapcm_read() and overall nicer.
This commit is contained in:
committed by
Lars Immisch
parent
061c297f4b
commit
691c1d9b23
@@ -1436,7 +1436,6 @@ static PyObject *alsapcm_write(alsapcm_t *self, PyObject *args)
|
||||
{
|
||||
int datalen;
|
||||
char *data;
|
||||
PyObject *rc = NULL;
|
||||
|
||||
#if PY_MAJOR_VERSION < 3
|
||||
if (!PyArg_ParseTuple(args,"s#:write", &data, &datalen))
|
||||
@@ -1493,7 +1492,7 @@ static PyObject *alsapcm_write(alsapcm_t *self, PyObject *args)
|
||||
}
|
||||
|
||||
if (res == -EAGAIN) {
|
||||
rc = PyLong_FromLong(0);
|
||||
res = 0;
|
||||
}
|
||||
else if (res < 0)
|
||||
{
|
||||
@@ -1511,7 +1510,7 @@ static PyObject *alsapcm_write(alsapcm_t *self, PyObject *args)
|
||||
PyBuffer_Release(&buf);
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
return PyLong_FromLong(res);
|
||||
}
|
||||
|
||||
static PyObject *
|
||||
|
||||
Reference in New Issue
Block a user