PyList_SetItem takes the ownership of its last argument[1]. Therefore,
Creating a PyObject, passing it to PyList_SetItem and then calling
Py_DECREF is an error.
Also removes a comment that was unsure of the behavior of PyList_SetItem
regarding memory leak.
PyList_SetItem takes the ownership of its last argument[1]. Therefore, Creating a PyObject, passing it to PyList_SetItem and then calling Py_DECREF is an error.
Also removes a comment that was unsure of the behavior of PyList_SetItem regarding memory leak.
[1] https://docs.python.org/3/c-api/list.html#c.PyList_SetItem