You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Within coroutines explicitly handled by the event decorator, e.g. during before_transition, after_transition callback execution, accessing self.instance_variable yields the expected response: 'hello'.
But as soon as the execution context of the event has been left, any instance variables (state) we model on the subclass, has been reset to its default. Perhaps the deepcopy does not work as it should with pydantic based instances, or the type inference introspection parts which honestly seems a bit like dark magic, is faulty. I'm unfamiliar with either of these mechanisms so unfortunately not of much help.
Anyhow, it behaves as if the entire StateMachine is recreated after each state transition, but not all the instance member variables are copied over.
I'm currently on Python 3.8 and have tried statesman versions 0.1.0 to 1.0.2post and they all exhibit the same behaviour.
Kind regards,
Yuka Poppe
The text was updated successfully, but these errors were encountered:
Perhaps I'm misunderstanding the way this FSM library is supposed to work, but I think this is a serious bug:
The
StateMachine
instance does not maintain state across a state transition.Infact the example code in README does not validate.
Within coroutines explicitly handled by the event decorator, e.g. during
before_transition
,after_transition
callback execution, accessingself.instance_variable
yields the expected response:'hello'
.But as soon as the execution context of the event has been left, any instance variables (state) we model on the subclass, has been reset to its default. Perhaps the deepcopy does not work as it should with pydantic based instances, or the type inference introspection parts which honestly seems a bit like dark magic, is faulty. I'm unfamiliar with either of these mechanisms so unfortunately not of much help.
Anyhow, it behaves as if the entire StateMachine is recreated after each state transition, but not all the instance member variables are copied over.
I'm currently on Python 3.8 and have tried statesman versions 0.1.0 to 1.0.2post and they all exhibit the same behaviour.
Kind regards,
Yuka Poppe
The text was updated successfully, but these errors were encountered: