From fe9d6b06fa490b400cc8ea9633aca563c646b453 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Mon, 4 Apr 2016 09:39:03 -0400 Subject: [PATCH] Fix use of weakref.ref Do not try to doubly use weakref in SDR, and otherwise use a more transparent weakref.proxy, since we are not hashing any values. Change-Id: Ib1e0e59b2e52988d75830ffa5422407c53a68561 --- pyghmi/ipmi/oem/lenovo/handler.py | 2 +- pyghmi/ipmi/sdr.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pyghmi/ipmi/oem/lenovo/handler.py b/pyghmi/ipmi/oem/lenovo/handler.py index 79c0dd1c..4c73ba03 100755 --- a/pyghmi/ipmi/oem/lenovo/handler.py +++ b/pyghmi/ipmi/oem/lenovo/handler.py @@ -128,7 +128,7 @@ class OEMHandler(generic.OEMHandler): # will need to retain data to differentiate # variations. For example System X versus Thinkserver self.oemid = oemid - self.ipmicmd = weakref.ref(ipmicmd) + self.ipmicmd = weakref.proxy(ipmicmd) self._has_megarac = None self.oem_inventory_info = None diff --git a/pyghmi/ipmi/sdr.py b/pyghmi/ipmi/sdr.py index a61bc8f4..e011d88b 100644 --- a/pyghmi/ipmi/sdr.py +++ b/pyghmi/ipmi/sdr.py @@ -252,7 +252,7 @@ class SDREntry(object): # ignore record id for now, we only care about the sensor number for # moment self.reportunsupported = reportunsupported - self.ipmicmd = weakref.ref(ipmicmd) + self.ipmicmd = ipmicmd if entrybytes[2] != 0x51: # only recognize '1.5', the only version defined at time of writing raise NotImplementedError @@ -585,7 +585,7 @@ class SDR(object): :param ipmicmd: A Command class object """ def __init__(self, ipmicmd): - self.ipmicmd = weakref.ref(ipmicmd) + self.ipmicmd = weakref.proxy(ipmicmd) self.sensors = {} self.fru = {} self.read_info()