Skip to content

Commit

Permalink
Addressed review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
agronholm committed May 10, 2024
1 parent eee7a90 commit 1b8ad98
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/anyio/_core/_eventloop.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,10 +155,13 @@ def get_async_backend(asynclib_name: str | None = None) -> type[AsyncBackend]:
if asynclib_name is None:
asynclib_name = sniffio.current_async_library()

# We use our own dict instead of sys.modules to get the already imported back-end
# class because the appropriate modules in sys.modules could potentially be only
# partially initialized
modulename = "anyio._backends._" + asynclib_name
try:
return loaded_backends[modulename]
return loaded_backends[asynclib_name]
except KeyError:
module = import_module(modulename)
backend_class = loaded_backends[modulename] = getattr(module, "backend_class")
return backend_class
loaded_backends[asynclib_name] = module.backend_class
return module.backend_class

0 comments on commit 1b8ad98

Please sign in to comment.