Open coretl opened 1 week ago
Suggestion:
ca_nothing.__bool__
emit a one time warning in cothread, telling the user to use ca_nothing.ok
insteadCan't make the warning in aioca as this will be too noisy because of the concurrent.futures.Future
usage above
This issue is exasperating, because it arises from a combination of two mistakes:
ca_nothing
was a mistake. Certainly this test is not necessary as all CA values returned by cothread support the .ok
attribute.concurrent.futures._base
are wrong, and should have been written as if self._exception is not None
. However, this appears to be established practice so we have to adapt our libraries accordingly.I have raised https://github.com/DiamondLightSource/cothread/issues/67 against https://github.com/DiamondLightSource/cothread
https://github.com/dls-controls/aioca/blob/12a0a68c249b90cd375b9432ed438c7a7e85ab97/aioca/_catools.py#L92-L93
Causes issues with various python internals, like
concurrent.futures.result
which does: https://github.com/python/cpython/blob/d5a8d4b19670b930cd6cb5e18e267877ebe49233/Lib/concurrent/futures/_base.py#L399So if we put a
CANothing
in as a result it shows as no exception...