Commit 9476c62
Kristoffel Pirard
prior: fix AttributeError for bad connections
When constructing a ProScanIII object on a port that does
not contain a prior controller, the _devices member is not
defined.
This causes the __del__ operation of the object to fail, because
it will end up in the base class' __del__, which requires the
`devices` property, which requires the `_devices` member to be present.
Conceptually, the `abc.Controller` class requires the implementation to be
a valid object. the `super().__init__` method may call any of the
public base members, so we have to make sure they are valid before
calling it.
One may also argue that the object is not allowed
to be constructed at all if not connected to a proper device; that
would be an alternative fix.1 parent 2c282da commit 9476c62
1 file changed
+4
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
214 | | - | |
215 | | - | |
216 | 214 | | |
217 | 215 | | |
| 216 | + | |
| 217 | + | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
| 225 | + | |
224 | 226 | | |
225 | 227 | | |
226 | 228 | | |
| |||
0 commit comments