Skip to content

Commit

Permalink
[Python] Fix DeviceProxyWrapper __del__ (#34011)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
agners authored and hhxxff committed Sep 27, 2024
1 parent 6c6a912 commit 1045092
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/controller/python/chip/ChipDeviceCtrl.py
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,7 @@ def __init__(self, deviceProxy: ctypes.c_void_p, proxyType, dmLib=None):

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

0 comments on commit 1045092

Please sign in to comment.