Skip to content

Commit 78439eb

Browse files
authored
fix: eventlet compatibility (#3132)
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 <[email protected]>
1 parent bc4c0d7 commit 78439eb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

docker/utils/socket.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import select
44
import socket as pysocket
55
import struct
6-
import sys
76

87
try:
98
from ..transport import NpipeSocket
@@ -32,7 +31,7 @@ def read(socket, n=4096):
3231
recoverable_errors = (errno.EINTR, errno.EDEADLK, errno.EWOULDBLOCK)
3332

3433
if not isinstance(socket, NpipeSocket):
35-
if sys.platform == 'win32':
34+
if not hasattr(select, "poll"):
3635
# Limited to 1024
3736
select.select([socket], [], [])
3837
else:

0 commit comments

Comments
 (0)