jcrist · GitHub

@jcrist mentioned this pull request

Feb 16, 2023

Open

These uses the same code path as `dataclasses`, with the same behaviors
and restrictions. In particular any attribute lacking a leading
underscore on an `attrs` type is encoded, regardless of if it's declared
as an attribute.
These follow the same code path as `dataclasses`, and have the same
restrictions:
- The generated `__init__` is not called. `msgspec` calls the proper
  hooks in the proper order.
- `__attrs_pre_init__` and `__attrs_post_init__` hooks are both
  supported and will be called on decode.
- `attrs.Factory(..., takes_self=True)` defaults aren't currently
  supported, but could be if someone asks for it.
This fixes a bug in both the dataclass and attrs decoder implementations
that previously prevented decoding a message into a frozen dataclass or
attrs type.

@jcrist

@jcrist

@jcrist

jcrist deleted the support-attrs branch

March 18, 2023 02:04

Read the original on github.com ↗