You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As discussed in agronholm/anyio#501 SniffIO doesn't detect it's running in asyncio when executing a callback added with loop.call_soon_threadsafe since it relies on asyncio.get_current_task for detection.
Using asyncio.get_running_loop should from my understanding work for all cases the current detection does and also allow detection in the case of executing in the event loop but not having a task.
I'll add a PR with the change implemented as well.
As discussed in agronholm/anyio#501 SniffIO doesn't detect it's running in asyncio when executing a callback added with
loop.call_soon_threadsafesince it relies onasyncio.get_current_taskfor detection.Using
asyncio.get_running_loopshould from my understanding work for all cases the current detection does and also allow detection in the case of executing in the event loop but not having a task.I'll add a PR with the change implemented as well.