Skip to content

[Bug Report] Slice string parsing rejects Python repr whitespace and accepts trailing text #9256

Backlog

Description

@sylvesterkaczmarek

Describe the bug

string_to_slice() does not trim individual slice components before checking for None, so ordinary Python representations such as slice(None, -3, None) fail. It also uses a prefix match, accepting trailing text after the slice expression.

Steps to reproduce

from isaaclab.utils.string import string_to_slice

value = slice(None, -3, None)
assert string_to_slice(repr(value)) == value

Actual: ValueError when converting the whitespace-prefixed None to an integer. Separately, string_to_slice('slice(0,2,1)garbage') returns a slice instead of rejecting malformed input.

System Info

main at ebf162a, macOS ARM64, Python 3.12. No Isaac Sim required.

Additional context

Require a full match and trim the captured components. Two new regressions check standard and compact representations and rejection of trailing text. Both failed on main and passed with the correction. All 31 string and dictionary tests passed.

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions