Skip to content

Evolve converts/validates again not changed fields #1126

Open
@ponomar

Description

@ponomar

Here's the usecase:

def decrypt_secret(value):
    return ...

@attrs.frozen
class Settings:
    user: str
    pwd: str = attrs.field(converter=decrypt_secret)

sett = Settings(user="name", pwd=<encrypted_value>)
sett.pwd  # already decrypted value

attrs.evolve(sett, user="name2")

This will fail, because it tries to decrypt already decrypted value, although the field pwd not changed at all.

Probably it is a wrong behaviour to convert/validate not changed fields.

Didn't find how to avoid converting/validating in this case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions