-
Notifications
You must be signed in to change notification settings - Fork 11
Open
Description
As discussed in DiamondLightSource/aioca#45 it would appear that allowing a ca_nothing value to return False to a boolean test triggers unexpected behaviour: it turns out that Exception subclasses are expected by core Python libraries to return True when tested with __bool__.
The obvious fix is to delete the implementation of ca_nothing.__bool__ here:
cothread/src/cothread/catools.py
Lines 103 to 105 in bb62450
| def __bool__(self): | |
| return self.ok | |
| __nonzero__ = __bool__ # For python 2 |
bool(value) rather than value.ok. The only reasonable solution is probably to raise a one-shot deprecation warning when this function is called.
Fortunately I don't think the boolean test feature of ca_nothing is documented, but this still needs to be flagged as a breaking change.
Metadata
Metadata
Assignees
Labels
No labels