Repository navigation
fix(rollout): accept a sequence of MjData, not only a list - #3818
Merged
copybara-service[bot] merged 1 commit intoNov 21, 2026
Merged
copybara-service[bot] merged 1 commit into
copybara-service[bot] merged 1 commit into
Conversation
The signature and the docstring of rollout() and Rollout.rollout() accept Sequence[MjData], but the implementation only recognised list and wrapped anything else in a one-element list. A tuple therefore reached pybind11 as a tuple of MjData and failed with an opaque cast error. Treat only a bare MjData as the single-instance case and keep every other sequence as is. Signed-off-by: 郑润泽 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #3817.
rollout.rolloutandRollout.rolloutacceptUnion[mujoco.MjData, Sequence[mujoco.MjData]]in their signatures and docstrings, but they only recognised
listand wrapped every othervalue in a one-element list. A tuple of
MjDatatherefore reached pybind11 as a tuple andfailed with
RuntimeError: Unable to cast Python instance of type <class 'tuple'>.Only a bare
MjDatais the single-instance case now; any other sequence is used as given.Tests
New
test_data_accepts_a_sequenceruns the same rollout with a list and with a tuple andcompares both outputs.
main: the new test fails with the cast error.rollout_test.py70 passed, 1 skipped.