Pickling & decorators #499
Replies: 1 comment 16 replies
-
Hi @emptierset, how's it going? Thanks for reporting this! I noticed there aren't automated tests specifically for pickle. I did some manual tests in the past, and it worked fine back then. However, a lot has changed internally, so this might be a regression. State machines are meant to be serializable, but I'd love to understand your use case better. Could you share what you're trying to achieve by serializing the state machine? I'm asking because maybe an approach like this could be good enough. I'll set up an automated test to reproduce the issue. Do you happen to have a complete example that demonstrates the problem? Looking forward to your reply! |
Beta Was this translation helpful? Give feedback.
-
We are using this library for an implementation of a board game.
We need the ability to pickle and unpickle games. We are using
dill
for this because my initial attempts to pickle with basicpickle
saw failures[0] when it tried to pickle certain things insideStateMachine
. We noticed an interesting bug when unpicking saved games and I was wondering if you might have any input.Essentially, we have a transition list like this:
When playing a game after it was pickled and unpickled, sometimes it goes to
GAME_END
at surprising times, even if manually callinggame_is_over
via REPL shows that it is false. After some digging, I identified that thecond
isn't actually running, so the "game over" transition is always getting picked.Do you have any idea why pickling and/or unpickling causes
cond
to "fall off"?Is your expectation that state machines are serializable?
Do you think switching our codebase to a non-decorator approach would help?
[0]: Specifically, it failed with
AttributeError: Can't pickle local object 'SignatureAdapter.wrap.<locals>.signature_adapter'
.Beta Was this translation helpful? Give feedback.
All reactions