int
PyList_Append(PyObject *op, PyObject *newitem)
{
if (PyList_Check(op) && (newitem != NULL)) {
Py_INCREF(newitem);
return _PyList_AppendTakeRef((PyListObject *)op, newitem);
}
PyErr_BadInternalCall();
return -1;
}
https://habr.com/ru/post/442800/