2
0
mirror of https://opendev.org/x/pyghmi synced 2025-01-14 11:48:33 +00:00

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
This commit is contained in:
Jarrod Johnson 2016-04-04 09:39:03 -04:00
parent 9b547cfb5a
commit fe9d6b06fa
2 changed files with 3 additions and 3 deletions

View File

@ -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

View File

@ -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()