@@ -67,6 +67,13 @@ fail after upgrading:
6767 awaiting a delayed one, which was never answered, now gets ` None ` , or ` TransitionNotAllowed `
6868 on a ` StateMachine ` . See
6969 {ref}` release-3.2.2-macrostep ` .
70+ - When an exception escapes an internal event or eventless transition enabled by an external
71+ event (any exception on a ` StateMachine ` , one from a validator or ` prepare_event ` on a
72+ ` StateChart ` ), the events still queued are dropped, and a coroutine awaiting one gets the
73+ exception. The queued external events used to run before the internal event or eventless
74+ transition. Internal events raised before a callback fails, and events sent before a failed
75+ lazy initial activation on the async engine, are dropped too, instead of running at the next
76+ event. See {ref}` release-3.2.2-macrostep ` .
7077- An attribute named with the ` error_ ` , ` done_state_ ` or ` done_invoke_ ` prefix now registers
7178 two events, so ` events ` , ` allowed_events ` and ` enabled_events() ` list both ids. See
7279 {ref}` release-3.2.2-prefixed-events ` .
@@ -363,8 +370,23 @@ machine terminates because every region of a top-level parallel state reached a
363370On 3.2.1, a coroutine awaiting a delayed event still pending when the machine terminated was
364371never answered.
365372
373+ An exception that escapes the internal events or eventless transitions following an external
374+ event is now handled like one escaping the external event itself: every event still queued,
375+ internal or external, delayed or not, is dropped, and a coroutine awaiting the ` send() ` of a
376+ dropped event gets that exception. Any exception escapes with ` catch_errors_as_events=False ` ,
377+ as on a ` StateMachine ` ; on a ` StateChart ` , one from a validator or ` prepare_event ` does. On
378+ 3.2.1 the queued external events ran before those internal events and eventless transitions,
379+ and their callers got their own results; the exception was then raised by the sync ` send() `
380+ that started processing, and on the async engine it reached no caller. On the async engine, as
381+ on 3.2.1, the coroutine whose event enabled the failing transitions gets its own event's
382+ result. Internal events raised by a callback before it fails are dropped too: they used to run
383+ at the next event. The same applies when the lazy initial activation fails on the async engine,
384+ where a second coroutine awaiting an event sent before it used to wait forever, and the events
385+ sent before it, which used to run at the next ` send() ` , are dropped.
386+
366387[ #668 ] ( https://github.com/fgmacedo/python-statemachine/pull/668 ) ,
367388[ #678 ] ( https://github.com/fgmacedo/python-statemachine/issues/678 ) ,
389+ [ #686 ] ( https://github.com/fgmacedo/python-statemachine/issues/686 ) ,
368390[ #685 ] ( https://github.com/fgmacedo/python-statemachine/pull/685 ) .
369391
370392(release-3.2.2-prefixed-events)=
0 commit comments