Skip to content

Commit f8bd891

Browse files
authored
PYTHON-5039 - Always use asyncio.get_running_loop() instead of asynci… (#2063)
1 parent 069ebf3 commit f8bd891

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pymongo/network_layer.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
async def async_sendall(sock: Union[socket.socket, _sslConn], buf: bytes) -> None:
7373
timeout = sock.gettimeout()
7474
sock.settimeout(0.0)
75-
loop = asyncio.get_event_loop()
75+
loop = asyncio.get_running_loop()
7676
try:
7777
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
7878
await asyncio.wait_for(_async_sendall_ssl(sock, buf, loop), timeout=timeout)
@@ -259,7 +259,7 @@ async def async_receive_data(
259259
timeout = sock_timeout
260260

261261
sock.settimeout(0.0)
262-
loop = asyncio.get_event_loop()
262+
loop = asyncio.get_running_loop()
263263
cancellation_task = create_task(_poll_cancellation(conn))
264264
try:
265265
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
@@ -290,7 +290,7 @@ async def async_receive_data_socket(
290290
timeout = sock_timeout
291291

292292
sock.settimeout(0.0)
293-
loop = asyncio.get_event_loop()
293+
loop = asyncio.get_running_loop()
294294
try:
295295
if _HAVE_SSL and isinstance(sock, (SSLSocket, _sslConn)):
296296
return await asyncio.wait_for(

0 commit comments

Comments
 (0)