Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Possible error in Sequence tick #458

Open
michieletto opened this issue Jan 3, 2025 · 1 comment
Open

Possible error in Sequence tick #458

michieletto opened this issue Jan 3, 2025 · 1 comment

Comments

@michieletto
Copy link

Hi,
Thanks for the great library!
I've had a look at the code in the devel branch, and entered the Sequence class method tick.
At line 561, you yield node.
Then, the code checks if the node is the child itself and the node status is SUCCESS.
Then, after some operations, you yield again and return.

I might be wrong, but I think the yield at line 561 is somehow in the wrong place.
Maybe it should be moved after the checks?
It's otherwise hard to reach those checks with the current version, right?

If I'm wrong, please can someone better explain the idea behind the code?

Thanks.
Best.
Stefano

@michieletto
Copy link
Author

michieletto commented Jan 7, 2025

I am also wondering if the checks at line 542 and line 545 are correct.

The current version is:

        elif self.memory and common.Status.RUNNING:
            assert self.current_child is not None  # should never be true, help mypy out
            index = self.children.index(self.current_child)
        elif not self.memory and common.Status.RUNNING:
            self.current_child = self.children[0] if self.children else None

but I suppose it should be:

        elif self.memory and self.status == common.Status.RUNNING:
            assert self.current_child is not None  # should never be true, help mypy out
            index = self.children.index(self.current_child)
        elif not self.memory and self.status == common.Status.RUNNING:
            self.current_child = self.children[0] if self.children else None

or even better:

        elif self.memory:
            assert self.current_child is not None  # should never be true, help mypy out
            index = self.children.index(self.current_child)
        else:
            self.current_child = self.children[0] if self.children else None

since as commented at line 549 these conditions should cover all variations

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant