Skip to content

Incorrect to_builtins convertion with builtin_types=(frozendict,) #1104

Closed

Description

@sobolevn

I did not test it enough. It does not convert the internal objects:

def test_frozendict_builtin_types(self):
    msg = to_builtins(frozendict({"test": 1}), builtin_types=(frozendict,))
    assert type(msg) is frozendict
    assert msg == frozendict({"test": 1})

    msg = to_builtins(
        frozendict(
            {
                "test": frozendict({1: "a"}),
                FruitStr.BANANA: 1,
                "b": [FruitInt.APPLE],
            }
        ),
        builtin_types=(frozendict,),
    )
    assert type(msg) is frozendict
    assert type(msg["test"]) is frozendict
    assert type(list(msg.keys())[1]) is str
    assert msg == frozendict({
        "test": frozendict({1: "a"}),
        "banana": 1,
        "b": [-1],
    })

this test fails.

I have a fix for this.

Activity

  1. self-assigned this
    on Jul 1, 2026
  2. added a commit that references this issue on Jul 2, 2026
    903a340
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions