summaryrefslogtreecommitdiffstats
path: root/src/vpp-api/python
diff options
context:
space:
mode:
authorOle Troan <ot@cisco.com>2019-10-21 18:59:11 +0200
committerAndrew Yourtchenko <ayourtch@gmail.com>2019-10-21 17:55:13 +0000
commit22674295747965759806231c8e5beb4b1d7fa96a (patch)
tree4479a1a88b13a35d1b4708f05893cbafd70f3596 /src/vpp-api/python
parent74dcbf97af4e55cb29932dad7d65472403c6006d (diff)
bier: tests support python3
Type: fix Signed-off-by: Ole Troan <ot@cisco.com> Change-Id: I3cf5295f1a85579a66ba38ca1f74678b45474959
Diffstat (limited to 'src/vpp-api/python')
-rw-r--r--src/vpp-api/python/vpp_papi/vpp_serializer.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/src/vpp-api/python/vpp_papi/vpp_serializer.py b/src/vpp-api/python/vpp_papi/vpp_serializer.py
index 5b45cd8a569..8ae46fee83c 100644
--- a/src/vpp-api/python/vpp_papi/vpp_serializer.py
+++ b/src/vpp-api/python/vpp_papi/vpp_serializer.py
@@ -250,21 +250,22 @@ class VLAList(object):
self.options = args
return self
- def pack(self, list, kwargs=None):
- if not list:
+ def pack(self, lst, kwargs=None):
+ if not lst:
return b""
- if len(list) != kwargs[self.length_field]:
+ if len(lst) != kwargs[self.length_field]:
raise VPPSerializerValueError(
'Variable length error, got: {} expected: {}'
- .format(len(list), kwargs[self.length_field]))
- b = bytes()
+ .format(len(lst), kwargs[self.length_field]))
# u8 array
-
if self.packer.size == 1:
- return bytearray(list)
+ if isinstance(lst, list):
+ return b''.join(lst)
+ return bytes(lst)
- for e in list:
+ b = bytes()
+ for e in lst:
b += self.packer.pack(e)
return b