Skip to content
Merged
Changes from 1 commit
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: 5 additions & 1 deletion pymongo/network_layer.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import asyncio
import collections
import errno
import os
import socket
import struct
import sys
Expand Down Expand Up @@ -286,6 +287,7 @@ async def _async_socket_receive(


_PYPY = "PyPy" in sys.version
_WINDOWS = os.name == "nt"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our usual windows check is sys.platform == "win32"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated



def wait_for_read(conn: Connection, deadline: Optional[float]) -> None:
Expand Down Expand Up @@ -337,7 +339,8 @@ def receive_data(conn: Connection, length: int, deadline: Optional[float]) -> me
while bytes_read < length:
try:
# Use the legacy wait_for_read cancellation approach on PyPy due to PYTHON-5011.
if _PYPY:
# also use it on Windows due to PYTHON-5405
if _PYPY or _WINDOWS:
wait_for_read(conn, deadline)
if _csot.get_timeout() and deadline is not None:
conn.set_conn_timeout(max(deadline - time.monotonic(), 0))
Expand All @@ -359,6 +362,7 @@ def receive_data(conn: Connection, length: int, deadline: Optional[float]) -> me
raise _OperationCancelled("operation cancelled") from None
if (
_PYPY
or _WINDOWS
or not conn.is_sdam
and deadline is not None
and deadline - time.monotonic() < 0
Expand Down
Loading