From b23493a7d2e58bdc62a35be256e55c32185fe223 Mon Sep 17 00:00:00 2001 From: Ben Beasley Date: Tue, 10 Jan 2023 13:20:08 -0500 Subject: [PATCH] Fix Python host-endianness dependencies (#7773) * In Python tests, use host-endian-independent dtypes * Fix host endianness dependence in Python flexbuffers Co-authored-by: Derek Bailey --- python/flatbuffers/flexbuffers.py | 10 +++++----- tests/py_flexbuffers_test.py | 6 +++--- tests/py_test.py | 30 +++++++++++++++--------------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/python/flatbuffers/flexbuffers.py b/python/flatbuffers/flexbuffers.py index aaa02fdaf..34d42a698 100644 --- a/python/flatbuffers/flexbuffers.py +++ b/python/flatbuffers/flexbuffers.py @@ -75,7 +75,7 @@ class BitWidth(enum.IntEnum): @staticmethod def F(value): """Returns the `BitWidth` to encode floating point value.""" - if struct.unpack('f', struct.pack('f', value))[0] == value: + if struct.unpack('