encode/httpcore

Handle `NotImplementedError: unsupported platform` case.

tomchristie opened this issue · 0 comments

If these three things occur...

  • The user is using httpcore either with standard sync, or with asyncio.
  • The trio package happens to be installed.
  • We are running on a platform that's unsupported by Trio.

Then there's a case where an import of trio can occur and trigger a NotImplementedError: unsupported platform exception. (python-trio/trio#3013)

I'd suggest:

  • We start with a nice simple fix, and catch the case here...
    except ImportError: # pragma: nocover
  • Ideally we ensure that we don't run import trio or import anyio unless we're actually running async.