The Spawn option raise_on_wait causes reporting of any exception terminating the spawned cothread to be deferred until .Wait() is called on the associated cothread, for instance:
def task(): raise Exception('Die')
def test():
action = Spawn(task, raise_on_wait = True)
action.Wait()
Unfortunately if .Wait() is never called then the associated exception is never reported.
It might be possible to fix this by added a __del__ method to Spawn and reporting any exception that hasn't already been reported.
The
Spawnoptionraise_on_waitcauses reporting of any exception terminating the spawned cothread to be deferred until.Wait()is called on the associated cothread, for instance:Unfortunately if
.Wait()is never called then the associated exception is never reported.It might be possible to fix this by added a
__del__method toSpawnand reporting any exception that hasn't already been reported.