Skip to content

state_pickler.get_state fails for attributes resulting in StateTuple #300

Description

@johannesloibl
from traits.api import HasTraits, Dict, Str, Tuple, List
from apptools.persistence import state_pickler as sp


class Model(HasTraits):
    dict_item = Dict()
    tuple_item = Tuple()
    str_item = Str()
    list_item = List()


def main():
    inner = Model(
        dict_item=dict(a=1),
        tuple_item=(1, 2, 3),
        str_item="bla",
        list_item=[4, 5, 6]
    )
    outer = Model(
        dict_item=dict(a=inner),
        tuple_item=(inner, inner),
        str_item="blubb",
        list_item=[inner, inner]
    )

    state = sp.get_state(outer)


if __name__ == '__main__':
    main()

This results in following exception:
image

Removing tuple_item=(inner, inner), makes it work again.

OS: Win 10
Pkg Versions:
traits==6.3.1
apptools==5.1.0

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