Skip to content

defaults should be asigned to the structure, as opposed to constructed while assessing #84

Closed
@loyada

Description

@loyada

Here is an example of a bug:

    class Foo(Structure):
        a: Array(items=String, default=list)
    

    foo = Foo()
    assert foo.a == []
    foo.a.append(123)                    # this should be invalid, but it works since the list is disconnected from the structure
    assert foo.a == [123]                # fails, since foo.a returns [] . 

If defaults will be set during initialization instead, it would work as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions