Skip to content

Avoiding shared mutable defaults #26

Description

@lenadax

Description

Schema classes currently do not check for shared mutable defaults, leading to unintended behavior.

Example

@plumbing(Schema)
class Example:
    schema = {
        'data': schema.Dict(default={}) # => mutable default, shared across instances
    }

Potential solution

Introduce a default_factory option to generate unique defaults.

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