static void tasklet_dealloc(PyTaskletObject *t) { if (tasklet_has_c_stack(t)) { /* * we want to cleanly kill the tasklet in the case it * was forgotten. One way would be to resurrect it, * but this is quite ugly with many ifdefs, see * classobject/typeobject. * Well, we do it. */ if (slp_resurrect_and_kill((PyObject *) t, kill_finally)) { /* the beast has grown new references */ return; } } tasklet_clear_frames(t); if (t->tsk_weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *)t); if (t->cstate != NULL) { assert(t->cstate->task != t || t->cstate->ob_size == 0); Py_DECREF(t->cstate); } Py_DECREF(t->tempval); Py_XDECREF(t->def_globals); t->ob_type->tp_free((PyObject*)t); }
static void channel_dealloc(PyObject *ob) { PyChannelObject *ch = (PyChannelObject *) ob; if (ch->balance) { if (slp_resurrect_and_kill(ob, channel_clear)) { /* the beast has grown new references */ return; } } if (ch->chan_weakreflist != NULL) PyObject_ClearWeakRefs((PyObject *)ch); ob->ob_type->tp_free(ob); }