oremanj / greenback

Reenter an asyncio or Trio event loop from synchronous code
https://greenback.readthedocs.io/
Other
77 stars 2 forks source link

has_portal() throws in asyncio mode if there is no current task #16

Closed oremanj closed 1 year ago

oremanj commented 1 year ago

For example this state is attainable within an asyncio FD reader callback (loop.add_reader). sniffio still reports "asyncio" in this case but greenback is not usable. We should catch the RuntimeError in has_portal and return false.