From 8be150b0904233d097b7e1cf78308c60bd5a146e Mon Sep 17 00:00:00 2001 From: Tim Rid <6593626+timrid@users.noreply.github.com> Date: Sun, 24 Jan 2021 17:49:39 +0100 Subject: [PATCH] adding also values that are not part of the dataclass to the "TContainer" while parsing --- construct_typed/tstruct.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/construct_typed/tstruct.py b/construct_typed/tstruct.py index 44a139e..16f06ce 100644 --- a/construct_typed/tstruct.py +++ b/construct_typed/tstruct.py @@ -142,6 +142,9 @@ class _TStruct(Adapter[t.Any, t.Any, ContainerType, BuildTypes]): value = getattr(obj, field.name) setattr(dc, field.name, value) + # also transfer values that are not part of the dataclass + dc.update(obj) + return dc def _encode(