File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212from . import quasixml as ET_quasi_xml
1313from collections import namedtuple
1414import os
15- import fcntl
1615import ast
1716import threading
1817from irods .message .message import Message
@@ -153,7 +152,15 @@ def ET(xml_type = 0, server_version = None):
153152
154153
155154# Necessary for older python (<3.7):
156- _socket_is_blocking = (lambda self : 0 == fcntl .fcntl (self .fileno (), fcntl .F_GETFL ) & os .O_NONBLOCK )
155+
156+ def _socket_is_blocking (sk ):
157+ try :
158+ return sk .getblocking ()
159+ except AttributeError :
160+ # Python 3.7+ docs say sock.getblocking() is equivalent to checking if sock.gettimeout() == 0, but this is misleading.
161+ # Manual testing shows this to be a more accurate equivalent:
162+ timeout = sk .gettimeout ()
163+ return (timeout is None or timeout > 0 )
157164
158165def _recv_message_in_len (sock , size ):
159166 size_left = size
You can’t perform that action at this time.
0 commit comments