Oh... I got it! :) I found this line in ctypes.h: #define Py_TYPE(q) = ((PyObject *)(q))->ob_next; So those lines are trying to set the blocks type from rear to front. But I still don't know why after the while (when q is equal to p), the Py_TYPE(q) set to NULL!