Skip to content

internal declared on an Event has no effect at trigger time #655

Description

@fgmacedo

Event(a.to(b), internal=True) is meant to put the event on the internal queue, which is what
Event.put reads (self._sm._put_nonblocking(trigger_data, internal=self.internal)). But nothing
ever carries the declared value to the object that put is called on:

  • Event.__get__ builds BoundEvent(id=..., name=..., delay=..., _sm=instance) and omits
    internal, so sm.go() always uses the default False.
  • StateChart.send reads know_event.delay from the class attribute but takes internal only
    as its own parameter, so sm.send("go") ignores the declaration too.

Measured after #645, which fixed the declaration side:

class Internal(StateChart):
    a = State(initial=True)
    b = State(final=True)
    go = Event(a.to(b), internal=True)

[e.internal for e in Internal.events]  # [True]  -- declaration is preserved
Internal().go.internal                 # False   -- the bound event is not

delay works end to end through both paths; internal is the one left inert. #645 fixed the declaration side (see #647, closed) and deliberately stopped there, because the
remaining fix lives in event.py and statemachine.py, outside what that PR touched.

When fixing: docs/releases/3.2.2.md currently states that internal is preserved on the
declaration; update that once it actually takes effect, check whether docs/processing_model.md
should show the declarative form next to raise_(), and add an entry to the open release notes.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions