Closed
Description
>>> from trio.lowlevel import enable_ki_protection
>>> async def foo():
... return
...
>>> @enable_ki_protection
... async def bar():
... return
...
>>> import inspect
>>> inspect.iscoroutinefunction(foo)
True
>>> inspect.iscoroutinefunction(bar)
False
Found when I tried to update coroutine_or_error
in trio/_util.py
to use inspect.iscoroutinefunction
in #2668
Lines 137 to 141 in 3146638
There are also a ton of wrapper/helper methods in tests that un-coroutinefunction-ify functions, which'd need to be modified in order to actually use iscoroutinefunction
in couroutine_or_error
. This means it'd probably also break a bunch of downstream code if coroutine_or_error
was rewritten, but the upside of not having to call the function might mean that it's worth it (after a deprecation period)? That's probably for another issue though.
Metadata
Metadata
Assignees
Labels
No labels