Closed
Conversation
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.
Fixes two bugs with dataclass auto-serialization:
Bug 1 — Nested dataclasses lose the
AUTO_SERIALIZEDmarker:In shared.py,
dataclasses.asdict(obj)was used, which recursively converts all nested dataclass fields into plain dicts. Only the outermost dict received theAUTO_SERIALIZEDmarker, so inner dataclass objects deserialized as plaindictinstead ofSimpleNamespace.Fix: Replaced
dataclasses.asdict(obj)with a shallow field extraction. This leaves nesteddataclassvalues as-is, so the encoder callsdefault()on each one individually, giving each its ownAUTO_SERIALIZEDmarker.Bug 2 —
SimpleNamespacemutation:vars(obj)returns the object's actual__dict__, not a copy. Addingd[AUTO_SERIALIZED] = Truepermanently mutated the originalSimpleNamespaceby injecting an__durabletask_autoobject__attribute.Fix: Changed
vars(obj)todict(vars(obj))to work on a copy.