Closed mcvady closed 9 months ago
Hello @mcvady,
this is unfortunately a common pitfall. AsyncMachine
requires AsyncState
as a state class. Simple State
instances do not feature async processing.
from transitions.extensions.asyncio import AsyncState
Each machine class has a state_cls
class property that is used to create state instances. Similarly, event_cls
and transition_cls
are used for the creation of events and transitions.
Ah, I see @aleneum. Thank you for your work and the quick reply.
Thank you for taking the time to report a bug! Your support is essential for the maintenance of this project. Please fill out the following fields to ease bug hunting and resolving this issue as soon as possible:
Describe the bug
AsyncMachine transitions fail when a list of
State
objects are passed in to the FSM.Minimal working example
The following example works as expected. First
A
is printed. Then the transition is awaited/occurs, thenB
is printed.If
STATES
is defined as a list of dictionaries, the example still works fine. e.g:However when
STATES
is a list ofState
objects, e.g:... now awaiting the transition coroutine blows up:
Expected behavior Passing in list of explicit
State
objects should work the same using dictionaries or strings.Additional context Using Python 3.10.12.