C-Extension: Ref count of generators

I’m trying to get the Py_INCREF‘s and Py_DECREF‘s for my c extension right. Whilst doing so I’ve been stumbling about really high values for generators. What I’ve been doing is the following: // Forgive me for leaving out the NULL checks PyObject *get_generator = PyUnicode_InternFromString(“get_generator”); PyObject *callback; PyObject *seq; PyObject *item; callback = PyObject_CallMethodObjArgs(parent->state, get_generator,…

Details