use PyList_SET_ITEM instead of PyList_SetItem,
PyList_SetItem does error checking and decref's existing values, PyList_SET_ITEM is a macro for direct assignment, only for use on new lists.
This commit is contained in:
@@ -216,13 +216,13 @@ static PyObject* gPyGetSpectrum(PyObject*)
|
||||
|
||||
for (int index = 0; index < 512; index++)
|
||||
{
|
||||
PyList_SetItem(resultlist, index, PyFloat_FromDouble(spectrum[index]));
|
||||
PyList_SET_ITEM(resultlist, index, PyFloat_FromDouble(spectrum[index]));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (int index = 0; index < 512; index++)
|
||||
{
|
||||
PyList_SetItem(resultlist, index, PyFloat_FromDouble(0.0));
|
||||
PyList_SET_ITEM(resultlist, index, PyFloat_FromDouble(0.0));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user