Skip to content

Serializing reuses original objects? #566

@istankovic

Description

@istankovic

Consider the following simple program:

from dataclasses import dataclass 
import apischema                         
                                         
@dataclass                               
class Foo:                               
    d: dict[str, int]                    
                                         
                                         
d = {}                                   
foo = Foo(d=d)                           
print(d is apischema.serialize(foo)['d'])

This program will print True.
Is it expected and desired that apischema.serialize reuses original objects?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions