laforge has submitted this change. (
https://gerrit.osmocom.org/c/python/pyosmocom/+/38186?usp=email )
Change subject: osmocom.construct: Don't forget context when calling sizeof in Rpad
......................................................................
osmocom.construct: Don't forget context when calling sizeof in Rpad
When calling the self.sizeof() method, we must pass in the context
in order to make expressions like 'this._.total_len' work.
Change-Id: I97e4b8fffcccba0b9d0ecb18c76a2a30fd990fd2
---
M src/osmocom/construct.py
1 file changed, 1 insertion(+), 1 deletion(-)
Approvals:
dexter: Looks good to me, approved; Verified
Jenkins Builder: Verified
diff --git a/src/osmocom/construct.py b/src/osmocom/construct.py
index 753b5de..8f01f3c 100644
--- a/src/osmocom/construct.py
+++ b/src/osmocom/construct.py
@@ -341,7 +341,7 @@
return obj.rstrip(self.pattern)
def _encode(self, obj, context, path):
- target_size = self.sizeof() * self.num_per_byte
+ target_size = self.sizeof(**context) * self.num_per_byte
if len(obj) > target_size:
raise SizeofError("Input ({}) exceeds target size ({})".format(
len(obj), target_size))
--
To view, visit
https://gerrit.osmocom.org/c/python/pyosmocom/+/38186?usp=email
To unsubscribe, or for help writing mail filters, visit
https://gerrit.osmocom.org/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: python/pyosmocom
Gerrit-Branch: master
Gerrit-Change-Id: I97e4b8fffcccba0b9d0ecb18c76a2a30fd990fd2
Gerrit-Change-Number: 38186
Gerrit-PatchSet: 1
Gerrit-Owner: laforge <laforge(a)osmocom.org>
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: dexter <pmaier(a)sysmocom.de>
Gerrit-Reviewer: laforge <laforge(a)osmocom.org>