This is code from the Twisted library:

https://github.com/twisted/twisted/blob/trunk/src/twisted/internet/defer.py#L1542-L1614

It "unwinds" a generator to yield a result before others.

I don't have hard evidence, but my experience is that that kind of manipulation leaks resources, specially if exceptions escape from the final callback.

Is there a bug in exception handling in the generator logic, or is unwinding just inherently wrong?

How could the needs tried to solved with unwinding be handled with async?

--
Juancarlo AƱez