jcrist / msgspec

A fast serialization and validation library, with builtin support for JSON, MessagePack, YAML, and TOML
https://jcristharif.com/msgspec/
BSD 3-Clause "New" or "Revised" License
2.44k stars 75 forks source link

Add `msgspec.structs.force_setattr` #600

Closed jcrist closed 11 months ago

jcrist commented 11 months ago

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.