Skip to content

State machines cannot be pickled #85

@InigoMoreno

Description

@InigoMoreno

I was trying to pickle a State machine in order to save it on a file to be executed later and I saw that it cannot be pickled due to the _state_transitioning_lock variable. This could be fixed by adding the following to the state_machine class:

    def __getstate__(self):
        return {k:v for (k, v) in self.__dict__.items() if k is not "_state_transitioning_lock"}

    def __setstate__(self, d):
        self.__dict__ = d
        self._state_transitioning_lock = threading.Lock()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions