Skip to content

Commit

Permalink
Use get_running_loop instead of get_event_loop
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahStapp committed Jan 15, 2025
1 parent 882c0db commit f6c0136
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pymongo/asynchronous/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ async def _canonicalize_hostname(hostname: str, option: str | bool) -> str:
return hostname

if not _IS_SYNC:
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
af, socktype, proto, canonname, sockaddr = (
await loop.getaddrinfo(
hostname,
Expand Down
2 changes: 1 addition & 1 deletion pymongo/asynchronous/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,7 @@ async def _create_connection(address: _Address, options: PoolOptions) -> socket.

err = None
if not _IS_SYNC:
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
results = await loop.getaddrinfo( # type: ignore[assignment]
host, port, family=family, type=socket.SOCK_STREAM
)
Expand Down
2 changes: 1 addition & 1 deletion pymongo/synchronous/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ def _canonicalize_hostname(hostname: str, option: str | bool) -> str:
return hostname

if not _IS_SYNC:
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
af, socktype, proto, canonname, sockaddr = (
loop.getaddrinfo(
hostname,
Expand Down
2 changes: 1 addition & 1 deletion pymongo/synchronous/pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -813,7 +813,7 @@ def _create_connection(address: _Address, options: PoolOptions) -> socket.socket

err = None
if not _IS_SYNC:
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
results = loop.getaddrinfo( # type: ignore[assignment]
host, port, family=family, type=socket.SOCK_STREAM
)
Expand Down

0 comments on commit f6c0136

Please sign in to comment.