Closed e0lithic closed 1 year ago
Describe the bug This issue is in continuance with the following discussion https://github.com/pytransitions/transitions/issues/485#issuecomment-1493360030. where trying to make a state transition during on_exception causes a RecursionError
The modifications made from the example cited by @aleneum in the example are as follows :
on_exit
Minimal working example
from transitions import Machine class Model: def handle_error(self): self.to_failure() def on_exit_failing(self): raise RuntimeError("Failing!") def __init__(self): self.machine = Machine( model=self, states=[ 'initial', {'name' : 'start', 'on_exit':'on_exit_failing'}, 'stop' ], initial='initial', on_exception='handle_error') self.machine.add_ordered_transitions(loop=False) self.machine.add_state("failure") model = Model() assert model.is_initial() model.next_state() assert model.is_start() # The next command will cause RecursionError model.next_state() assert model.is_failure()
Expected behavior Post exception the model should have transitioned to the failure state.
Describe the bug This issue is in continuance with the following discussion https://github.com/pytransitions/transitions/issues/485#issuecomment-1493360030. where trying to make a state transition during on_exception causes a RecursionError
The modifications made from the example cited by @aleneum in the example are as follows :
on_exit
callback.Minimal working example
Expected behavior Post exception the model should have transitioned to the failure state.