From 813de399b5206fe71fed79320cfe7e531dab2831 Mon Sep 17 00:00:00 2001 From: Jan-Philipp Litza Date: Wed, 24 Nov 2021 16:54:18 +0100 Subject: [PATCH] Fix size of SDR records becoming a float While receiving the SDR, when the size is uneven, its division by 2 causes it to become a float instead of an integer, leading to a TypeError later on: Traceback (most recent call last): File "gipmi/sdr.py", line 634, in __init__ self.read_info() File "gipmi/sdr.py", line 665, in read_info self.get_sdr() File "gipmi/sdr.py", line 740, in get_sdr sdrrec = self.ipmicmd.raw_command(netfn=0x0a, command=0x23, File "gipmi/command.py", line 500, in raw_command rsp = self.ipmi_session.raw_command(netfn=netfn, command=command, File "gipmi/private/session.py", line 779, in raw_command self._send_ipmi_net_payload(netfn, command, data, File "gipmi/private/session.py", line 819, in _send_ipmi_net_payload data = bytearray(data) TypeError: 'float' object cannot be interpreted as an integer Change-Id: I3e123487b27ef385823b1a20652195c7588f5d6c --- pyghmi/ipmi/sdr.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyghmi/ipmi/sdr.py b/pyghmi/ipmi/sdr.py index c90e9b5c..51480cde 100644 --- a/pyghmi/ipmi/sdr.py +++ b/pyghmi/ipmi/sdr.py @@ -778,7 +778,7 @@ class SDR(object): if size == 0xff: # get just 5 to get header to know length size = 5 elif size > 5: - size /= 2 + size //= 2 # push things over such that it's less # likely to be just 1 short of a read # and incur a whole new request