Conversation
serialize_dict passed an ordinary dict through unchanged, so a dict whose own keys include __burr_serde__ was read back as a serde envelope. deserialize then raised "No deserializer registered for key", which surfaced through State.deserialize as a state field that cannot be restored. The key is not documented as reserved. Wrap such a dict in an envelope that restores it verbatim; every other dict keeps its serialized form, and real envelopes still dispatch (or still raise the informative error when their module was not imported).
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
serde.deserializetreats any dict that carries__burr_serde__as a serde envelope:serialize_dictpasses an ordinary dict through unchanged, so an application value that happens to use that key — at any nesting depth — cannot be read back. ThroughState.serialize/State.deserializeit shows up as a state field that cannot be restored at all:The key is not documented as reserved anywhere, so nothing tells an application to avoid it.
What this changes
A plain dict whose keys include the marker is wrapped in an envelope that restores it verbatim. Every other dict keeps exactly the serialized form it has today, so previously saved states are unaffected, and a real envelope still dispatches to its deserializer — or still raises the existing "make sure the module registering the deserializer has been imported" error when it has not been imported.
How this was checked
tests/core/test_serde.py: a nested dict containing the marker round-trips,Statecontaining one deserializes, and an envelope whose deserializer was never imported still raises the informative error. The first two fail onmain, the third passes on both."burr.dict"round-trips.tests/core→ 399 passed (test_graphviz_display.pyneeds thedotbinary, which is not installed here),tests/integrations/serde→ 15 passed.black --line-length=100,isortandflake8at the versions pinned in.pre-commit-config.yaml.