forked from auracaster/pyalsaaudio
Move creation of dictionary to a point after error handling, when it is relatively certain that the function will succeed.
(cherry picked from commit 1820716a4bc018bb903b95bcf5d7cf83a5ebda9c)
This commit is contained in:
@@ -640,7 +640,7 @@ alsapcm_dumpinfo(alsapcm_t *self, PyObject *args)
|
||||
static PyObject *
|
||||
alsapcm_info(alsapcm_t *self, PyObject *args)
|
||||
{
|
||||
PyObject *info = PyDict_New();
|
||||
PyObject *info;
|
||||
PyObject *value;
|
||||
|
||||
unsigned int val,val2;
|
||||
@@ -659,6 +659,8 @@ alsapcm_info(alsapcm_t *self, PyObject *args)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
info = PyDict_New();
|
||||
|
||||
value=PyUnicode_FromString(snd_pcm_name(self->handle));
|
||||
PyDict_SetItemString(info,"name",value);
|
||||
Py_DECREF(value);
|
||||
|
||||
Reference in New Issue
Block a user