Skip to content

Add msgspec.structs.force_setattr#600

Merged
jcrist merged 1 commit intomainfrom
struct-force-setattr
Dec 4, 2023
Merged

Add msgspec.structs.force_setattr#600
jcrist merged 1 commit intomainfrom
struct-force-setattr

Conversation

@jcrist
Copy link
Copy Markdown
Owner

@jcrist jcrist commented Dec 4, 2023

This is an advanced (and potentially unsafe) function that allows for mutating a frozen struct. The primary use case for this is mutating the struct in a __post_init__ method before returning. Most users shouldn't ever use this.

Fixes #588.

This is an advanced (and potentially unsafe) function that allows for
mutating a frozen struct. The primary use case for this is mutating the
struct in a `__post_init__` method before returning. Most users
shouldn't ever use this.
@jcrist jcrist merged commit 5593670 into main Dec 4, 2023
@jcrist jcrist deleted the struct-force-setattr branch December 4, 2023 17:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow use of object.__setattr__ to modify frozen instances of Struct

1 participant