Fix attributes with device inheritance and repeated method wrapping regression in 9.4.0
The first commit adds tests to cover the problems, and more. See example of failed test run (before fix).
The next commit has the fix:
When wrapping accessor methods for attributes and commands, avoid re-wrapping the same method. Besides being unnecessary, it breaks if the wrapped method has different signature to the original.
Similarly, when wrapping the standard device methods (init_device
, always_executed_hook
, etc.),
re-wrapping is now avoided (inheritance could previously have caused this).
In the patching functions the logic was simplified (the branches with
a defined method were unnecessary). For write methods, we now use a
new name for the wrapped function instead of replacing the old name.
This makes it consistent with the other patching functions.
Note: creating derived classes will still call setattr
multiple
times with the identical name and method - this is not problematic.
The pipes get the same fix (unfortunately, we have no unit tests for pipes due to limitations in the file db implementation).
Fixes: #516 (closed)