Doc won't serialize with custom attribute #13309
-
How to reproduce the behaviourI am trying to use Doc.to_bytes() after extending Doc with a custom attribute. I can successfully serialize and deserialize the custom attribute on its own, but this fails with Doc.to_bytes(). Here's a minimal reproducible example: Your Environment
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
|
I get what you're trying to do, but as far as I know the In general, To step back a bit - wouldn't it be easier for your use-case to store these special spans on the This should serialize just fine. |
Beta Was this translation helpful? Give feedback.
I get what you're trying to do, but as far as I know the
Doc.set_extensiondoesn't supportto_bytesorfrom_bytesarguments - where did you get that example code from?In general,
Docobjects can be serialized with custom attributes, if those attributes are of a type thatsrsly.msgpack._packersupports.To step back a bit - wouldn't it be easier for your use-case to store these special spans on the
Doc's builtspansstructure?This should serialize just fine.