ob_refcnt of '*item' is 1 too high was expecting final item->ob_refcnt to be N + 1 (for some unknown N) due to object being referenced by: PyListObject.ob_item[0] but final item->ob_refcnt is N + 2 PyLongObject allocated at: item = PyLong_FromLong(random()); when PyList_Append() succeeds