From 510b46ff5699860225073e5348b9fe098ec3805c Mon Sep 17 00:00:00 2001 From: Ethan Haley Date: Fri, 13 May 2022 09:41:18 +0100 Subject: [PATCH] Fix set type bit order Python bistrings are processed MSB-first, but SBE set types are processed LSB first. Therefore, we need to reverse the encoding/decoding order as parsed. This may need to be tested for sets which are larger than 1 byte --- sbe/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbe/__init__.py b/sbe/__init__.py index fbb865d..27779a3 100644 --- a/sbe/__init__.py +++ b/sbe/__init__.py @@ -1054,7 +1054,7 @@ def _parse_schema(f: TextIO) -> Schema: elif action == "end": x = stack.pop() assert isinstance(stack[-1], Schema) - x.choices = sorted(x.choices, key=lambda y: int(y.value)) + x.choices = sorted(x.choices, key=lambda y: int(y.value), reverse=True) stack[-1].types[x.name] = x elif tag == "choice":