jcrist · GitHub

@jcrist

Previously we spent a lot of effort to detect types that could never be
decoded by a JSON decoder (but could be decoded by other protocols), and
raised a nicer error at Decoder-initialization-time in this case.
Due to our caching of TypeNodes, the code for doing this was some of the
fiddliest bits in msgspec. If a JSON-incompatible type was already
parsed and cached to build a MessagePack parser, we'd have to ignore the
cached value to retraverse the type to check again.
We delete all this code in favor of erroring at runtime. I don't expect
this to degrade usability - the user will still get an error, just at a
later point in usage. This simplifies our type parsing code
dramatically, making it easier to support new types.

Read the original on github.com ↗