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
Describe the bug
If you have a program that uses asyncio and trio (which can happen when using trio-asyncio), calls made from a differently-flavored async function cause a failure (from using the wrong backend).
If you'd like, I can submit a fix, but I figured I would file this first, in case you have a specific way you want it handled.
To Reproduce
If starting with asyncio, then switching to trio:
Hmm, I'm not sure if get_default_backend() should have to probe every time because someone might change the backend. This issue can be worked around by calling set_default_backend() like the tests do, or by specifying a backend to async I/O routines if you really want to mix trio and asyncio. Do you think that's enough?
For what it's worth, on my host, sniff() appears to be about 400 nanoseconds, which for most of our microbenchmarks, is below the level of which we'd worry about. Since get_backend itself has caching, the overall performance penalty here seems very minor, compared to the obscurity of this error.
But it's up to you, of course! I have a workaround in my application; always passing in backend=get_backend(sniff()) to resolve.
Describe the bug
If you have a program that uses asyncio and trio (which can happen when using trio-asyncio), calls made from a differently-flavored async function cause a failure (from using the wrong backend).
If you'd like, I can submit a fix, but I figured I would file this first, in case you have a specific way you want it handled.
To Reproduce
If starting with asyncio, then switching to trio:
Or, if starting with trio, then switching to asyncio:
Context (please complete the following information):
The text was updated successfully, but these errors were encountered: