Should GreenletExit trigger an errback in deferredGreenlet?
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Corotwine |
Invalid
|
Undecided
|
Unassigned |
Bug Description
Just been playing around with corotwine - neat hack. I'm still trying to get my head around greenlets (and twisted!) so I may be missing something here, but is this supposed to happen?
---
from py.magic import greenlet
from corotwine.defer import deferredGreenlet
MAIN = greenlet.
def f():
print 'f1'
MAIN.switch()
print 'f2'
fd = deferredGreenlet(f)
fd()
---
f1
Unhandled error in Deferred:
Traceback (most recent call last):
--- <exception caught here> ---
File "/home/
d.callback(
File "./greenlets/
MAIN.switch()
py.magic.
I think the problem is that intermediateGre
that propagates the GreenletExit into the errback, when I imagine it should instead be re-raised.
kmh
It's not clear to me that this is a bug, and in fact it seems like reasonable behavior. You switched away from the greenlet when it was impossible for anything to switch back to it. Which means it's impossible for the greenlet to then provide a result to the deferred in any way.
Are you suggesting that the error should be raised synchronously from the call of fd(), instead of being errbacked on the Deferred? I don't see the point, and it seems a bit undesirable, since the point of deferredGreenlet is to encapsulate results of greenlets in Deferreds.