-
Notifications
You must be signed in to change notification settings - Fork 11
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Accessing self.sm.leaf_state from a event-handler returns wrong state #7
Comments
Hi Raphael, Thanks for submitting this issue along with a great explanation and the code explaining the problem - in fact, I tweaked the code a bit and commited it in as one of the tests. Initially I wasn't convinced it was a bug as I thought that a So I fixed the issue and now the The new approach has its implications though, as now it's illegal to set manually the state machine states once a machine got initialized. I mean it breaks (and actually always did) the machine state integrity. Therefore, the following code is no longer valid and is removed from the tests:
Thanks again that you keep using the library and send me the issues you find. The feedback I got from you helps me a lot! I released the fixed version as 0.3.9 - it's deployed to pypi. Piotr |
Hi
I came across this problem and it is very likely that i'm doing something wrong, however i couldn't figure out what it might be.
After i create an object that has a statemachine with entry-handlers for the states, when i call
self.sm.leaf_state
from within an entry-handler, it will always return the same state, even if the statemachine changes its state.It's weird because if i access
self.sm.leaf_state
from outside the entry-handler, for example inside atest()
function, it will return the correct states.This script demonstrates my problem:
The output i get (python 3.5.2):
I would expect for both of the
print(self.sm.leaf_state)
to be the same. Am i doing something wrong?Btw thanks again for the great library, i'm using it quite a lot on an ESP32.
The text was updated successfully, but these errors were encountered: