Fix DeviceProxy constructor reference cycle
This problem is fixed in two ways:
- ensure the
cause
object that holds the exception with a reference cycle is cleared in theDeviceProxy__set_attr
method. Similarly, clearing done in__DeviceProxy__getattr
for symmetry. - Prevent the exception in the first place, by bypassing the calls to
__setattr
while constructing theDeviceProxy
object.
The__setattr
method tries to read the commands and attributes from the device, but this isn't possible so early in the constructor.
Added a test to cover this case. Both the new test, and the existing memory leak tests for DeviceProxy
were made a little more lenient as we see occasional failures in the pipeline. The causes could not be pinned down.
Change the bare except:
statement in __DeviceProxy___get_info_
to the general except Exception:
. This in line with
PEP8. The method is only used for str()
and repr()
, so it shouldn't need to catch SystemExit
and KeyboardInterrupt
.
Closes #412 (closed)