Skip to content

Commit

Permalink
add winloop as a valid event loop
Browse files Browse the repository at this point in the history
  • Loading branch information
Vizonex authored Mar 21, 2024
1 parent ca7b018 commit 4b74e55
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions aiodns/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ def __init__(self, nameservers: Optional[Sequence[str]] = None,
assert self.loop is not None
if sys.platform == 'win32':
if not isinstance(self.loop, asyncio.SelectorEventLoop):
raise RuntimeError(
'aiodns needs a SelectorEventLoop on Windows. See more: https://github.com/saghul/aiodns/issues/86')
try:
import winloop
if not isinstance(self.loop , winloop.Loop):
raise RuntimeError(
'aiodns needs a SelectorEventLoop on Windows. See more: https://github.com/saghul/aiodns/issues/86')
except ModuleNotFoundError:
raise RuntimeError(
'aiodns needs a SelectorEventLoop on Windows. See more: https://github.com/saghul/aiodns/issues/86')
kwargs.pop('sock_state_cb', None)
timeout = kwargs.pop('timeout', None)
self._timeout = timeout
Expand Down

0 comments on commit 4b74e55

Please sign in to comment.