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

Changed behaviour since v5.12.0 of traitlets.Set.set if value is a string #891

Closed
martinclaus opened this issue Nov 12, 2023 · 1 comment

Comments

@martinclaus
Copy link

Before v5.12.0, if the passed value is of type str, the new value hold by the traitlet was a set (or maybe a list?) with a single element of type string. Since 5.12.0, the value of the traitlet is the set of all characters contained in the original string. Hence, #883 introduced a breaking change.

A easy fix would be to change the respective method to:

def set(self, obj: t.Any, value: t.Any) -> None:
    if isinstance(value, str):
        return super().set(
            obj,
            set(
                [value],
            ),
        )
    else:
        return super().set(obj, value)
@minrk
Copy link
Member

minrk commented May 6, 2024

closed by #903, auto-close didn't parse the link

@minrk minrk closed this as completed May 6, 2024
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

2 participants