Issue 1257960: gen_send_ex: Assertion `f->f_back != ((void *)0)' failed. (original) (raw)

Logged In: YES user_id=56214

Sadly, this is not the cause of the IDLE problem, because it's the assert that's wrong here. The problem that's occurring is that f->f_back is NULL because the final garbage collection at shutdown is occurring with a NULL tstate->frame. Changing the assert to check that f->f_back==tstate->frame makes the (meaningless) error go away.

Basically, the problem here is because this code used to be the iternext routine, and it was never called by the GC. Now, generators are closed when they are garbage collected, so they can be executed during interpreter shutdown.

I've checked in a corrected assertion.