- while True:
- if v[:EOC_LEN].tobytes() == EOC:
- tlvlen = tlen + llen + vlen + EOC_LEN
- obj = self.__class__(
- value=tlv[:tlvlen].tobytes(),
- expl=self._expl,
- optional=self.optional,
- _decoded=(offset, 0, tlvlen),
- )
- obj.lenindef = True
- obj.tag = t
- return obj, v[EOC_LEN:]
- else:
- chunk, v = Any().decode(
- v,
- offset=sub_offset,
- decode_path=decode_path + (str(chunk_i),),
- leavemm=True,
- ctx=ctx,
- )
- vlen += chunk.tlvlen
- sub_offset += chunk.tlvlen
- chunk_i += 1
+ while v[:EOC_LEN].tobytes() != EOC:
+ chunk, v = Any().decode(
+ v,
+ offset=sub_offset,
+ decode_path=decode_path + (str(chunk_i),),
+ leavemm=True,
+ ctx=ctx,
+ )
+ vlen += chunk.tlvlen
+ sub_offset += chunk.tlvlen
+ chunk_i += 1
+ tlvlen = tlen + llen + vlen + EOC_LEN
+ obj = self.__class__(
+ value=tlv[:tlvlen].tobytes(),
+ expl=self._expl,
+ optional=self.optional,
+ _decoded=(offset, 0, tlvlen),
+ )
+ obj.lenindef = True
+ obj.tag = t
+ return obj, v[EOC_LEN:]