Skip to content

Commit a1211cd

Browse files
committed
Check availability of poll method before using
When eventlet is monkey patched, select.poll is removed since it is not thread safe. So check availability of `poll` method before using it. Fixes: kubernetes-client#1753 Fixes: kubernetes-client#1686 Signed-off-by: Abhijeet Kasurde <[email protected]>
1 parent 3165e80 commit a1211cd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

kubernetes/base/stream/ws_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ def update(self, timeout=0):
179179
# efficient as epoll. Will work for fd numbers above 1024.
180180
# select.epoll() - newest and most efficient way of polling.
181181
# However, only works on linux.
182-
if sys.platform.startswith('linux') or sys.platform in ['darwin']:
182+
if hasattr(select, "poll"):
183183
poll = select.poll()
184184
poll.register(self.sock.sock, select.POLLIN)
185185
r = poll.poll(timeout)

0 commit comments

Comments
 (0)