Change in pysim[master]: tlv: Fix recursive initialization from_dict()

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

laforge gerrit-no-reply at lists.osmocom.org
Thu Oct 21 10:43:48 UTC 2021


laforge has uploaded this change for review. ( https://gerrit.osmocom.org/c/pysim/+/25878 )


Change subject: tlv: Fix recursive initialization from_dict()
......................................................................

tlv: Fix recursive initialization from_dict()

When calling from_dict() on a hierarchy of nested BER_TLV_IE,
only the first/outer layer of TLV_IE_Collection would get its
'decoded' initialized correctly from the dict.  Subsequent layers
were not, as the 'decoded=' was passed as parameter during instance
initialization.  If we first instantiate the class and then call the
from_dict() method, the recursive initialization down the full hierarchy
works as expected.

Change-Id: I795a33ed8dfa8454dc9079c189ab7b2ba64a3b72
---
M pySim/tlv.py
1 file changed, 2 insertions(+), 1 deletion(-)



  git pull ssh://gerrit.osmocom.org:29418/pysim refs/changes/78/25878/1

diff --git a/pySim/tlv.py b/pySim/tlv.py
index 0dc746b..e1e2852 100644
--- a/pySim/tlv.py
+++ b/pySim/tlv.py
@@ -373,7 +373,8 @@
             for k in i.keys():
                 if k in self.members_by_name:
                     cls = self.members_by_name[k]
-                    inst = cls(decoded=i[k])
+                    inst = cls()
+                    inst.from_dict(i[k])
                     res.append(inst)
                 else:
                     raise ValueError('%s: Unknown TLV Class %s in %s; expected %s' %

-- 
To view, visit https://gerrit.osmocom.org/c/pysim/+/25878
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: pysim
Gerrit-Branch: master
Gerrit-Change-Id: I795a33ed8dfa8454dc9079c189ab7b2ba64a3b72
Gerrit-Change-Number: 25878
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge at osmocom.org>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20211021/322fd468/attachment.htm>


More information about the gerrit-log mailing list