summaryrefslogtreecommitdiff
path: root/python/qpid
diff options
context:
space:
mode:
Diffstat (limited to 'python/qpid')
-rw-r--r--python/qpid/codec010.py8
-rw-r--r--python/qpid/spec010.py5
2 files changed, 9 insertions, 4 deletions
diff --git a/python/qpid/codec010.py b/python/qpid/codec010.py
index 0e4244fb75..f82a7a49dc 100644
--- a/python/qpid/codec010.py
+++ b/python/qpid/codec010.py
@@ -195,21 +195,21 @@ class Codec(Packer):
def read_control(self):
cntrl = self.spec.controls[self.read_uint16()]
- return cntrl.decode(self)
+ return Struct(cntrl, **cntrl.decode_fields(self))
def write_control(self, ctrl):
type = ctrl._type
self.write_uint16(type.code)
- type.encode(self, ctrl)
+ type.encode_fields(self, ctrl)
def read_command(self):
type = self.spec.commands[self.read_uint16()]
hdr = self.spec["session.header"].decode(self)
- cmd = type.decode(self)
+ cmd = Struct(type, **type.decode_fields(self))
return hdr, cmd
def write_command(self, hdr, cmd):
self.write_uint16(cmd._type.code)
hdr._type.encode(self, hdr)
- cmd._type.encode(self, cmd)
+ cmd._type.encode_fields(self, cmd)
def read_size(self, width):
if width > 0:
diff --git a/python/qpid/spec010.py b/python/qpid/spec010.py
index 4eb03008d0..03f60edc4e 100644
--- a/python/qpid/spec010.py
+++ b/python/qpid/spec010.py
@@ -192,6 +192,9 @@ class Composite(Type, Coded):
def decode(self, codec):
codec.read_size(self.size)
+ if self.code is not None:
+ code = codec.read_uint16()
+ assert self.code == code
return datatypes.Struct(self, **self.decode_fields(codec))
def decode_fields(self, codec):
@@ -211,6 +214,8 @@ class Composite(Type, Coded):
def encode(self, codec, value):
sc = StringCodec(self.spec)
+ if self.code is not None:
+ sc.write_uint16(self.code)
self.encode_fields(sc, value)
codec.write_size(self.size, len(sc.encoded))
codec.write(sc.encoded)