Skip to content

Commit

Permalink
fix: eventlet compatibility (#3132)
Browse files Browse the repository at this point in the history
Check if poll attribute exists on select module instead of win32 platform check

The implementation done in #2865 is breaking usage of docker-py library within eventlet.
As per the Python `select.poll` documentation (https://docs.python.org/3/library/select.html#select.poll) and eventlet select removal advice (eventlet/eventlet#608 (comment)), it is preferable to use an implementation based on the availability of the `poll()` method that trying to check if the platform is `win32`.

Fixes #3131

Signed-off-by: Mathieu Virbel <mat@meltingrocks.com>
  • Loading branch information
tito authored Jun 1, 2023
1 parent bc4c0d7 commit 78439eb
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions docker/utils/socket.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import select
import socket as pysocket
import struct
import sys

try:
from ..transport import NpipeSocket
Expand Down Expand Up @@ -32,7 +31,7 @@ def read(socket, n=4096):
recoverable_errors = (errno.EINTR, errno.EDEADLK, errno.EWOULDBLOCK)

if not isinstance(socket, NpipeSocket):
if sys.platform == 'win32':
if not hasattr(select, "poll"):
# Limited to 1024
select.select([socket], [], [])
else:
Expand Down

0 comments on commit 78439eb

Please sign in to comment.