Skip to content

Commit cea3370

Browse files
agnersdiogopintodsr
authored andcommitted
[Python] Fix DeviceProxyWrapper __del__ (project-chip#34011)
During tests the following unrelated Exception was raised: ``` Exception ignored in: <function DeviceProxyWrapper.__del__ at 0x7f12177b7a60> Traceback (most recent call last): File "/__w/connectedhomeip/connectedhomeip/out/venv/lib/python3.9/site-packages/chip/ChipDeviceCtrl.py", line 306, in __del__ if (self._proxyType == self.DeviceProxyType.OPERATIONAL and self.self._dmLib is not None and hasattr(builtins, 'chipStack') and builtins.chipStack is not None): AttributeError: 'DeviceProxyWrapper' object has no attribute 'self' Exception ignored in: <function DeviceProxyWrapper.__del__ at 0x7f12177b7a60> Traceback (most recent call last): File "/__w/connectedhomeip/connectedhomeip/out/venv/lib/python3.9/site-packages/chip/ChipDeviceCtrl.py", line 306, in __del__ if (self._proxyType == self.DeviceProxyType.OPERATIONAL and self.self._dmLib is not None and hasattr(builtins, 'chipStack') and builtins.chipStack is not None): AttributeError: 'DeviceProxyWrapper' object has no attribute 'self' ``` This fixes the issue by removing the extra `self` in the condition.
1 parent 827531a commit cea3370

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/controller/python/chip/ChipDeviceCtrl.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ def __init__(self, deviceProxy: ctypes.c_void_p, proxyType, dmLib=None):
268268

269269
def __del__(self):
270270
# Commissionee device proxies are owned by the DeviceCommissioner. See #33031
271-
if (self._proxyType == self.DeviceProxyType.OPERATIONAL and self.self._dmLib is not None and hasattr(builtins, 'chipStack') and builtins.chipStack is not None):
271+
if (self._proxyType == self.DeviceProxyType.OPERATIONAL and self._dmLib is not None and hasattr(builtins, 'chipStack') and builtins.chipStack is not None):
272272
# This destructor is called from any threading context, including on the Matter threading context.
273273
# So, we cannot call chipStack.Call or chipStack.CallAsyncWithCompleteCallback which waits for the posted work to
274274
# actually be executed. Instead, we just post/schedule the work and move on.

0 commit comments

Comments
 (0)