Skip to content

PYTHON-5039 - Always use asyncio.get_running_loop() instead of asynci… #2063

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 15, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pymongo/network_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
async def async_sendall(sock: Union[socket.socket, _sslConn], buf: bytes) -> None:
timeout = sock.gettimeout()
sock.settimeout(0.0)
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
try:
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
await asyncio.wait_for(_async_sendall_ssl(sock, buf, loop), timeout=timeout)
Expand Down Expand Up @@ -259,7 +259,7 @@ async def async_receive_data(
timeout = sock_timeout

sock.settimeout(0.0)
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
cancellation_task = create_task(_poll_cancellation(conn))
try:
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
Expand Down Expand Up @@ -290,7 +290,7 @@ async def async_receive_data_socket(
timeout = sock_timeout

sock.settimeout(0.0)
loop = asyncio.get_event_loop()
loop = asyncio.get_running_loop()
try:
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
return await asyncio.wait_for(
Expand Down
Loading