In Objects/genobject.c, it distinguishes between a simple yield and exhaustion of the generator by testing f->f_stacktop:
if (result && f->f_stacktop == NULL) {
... exhausted ...
}
else ... {
... normal yield ...
}
Need a way to signal the distinction without relying on f->f_stacktop.