summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorKen Giusti <kgiusti@apache.org>2014-05-30 13:08:23 +0000
committerKen Giusti <kgiusti@apache.org>2014-05-30 13:08:23 +0000
commit027b5e3cdbf37ce50c6e7fae7872d1ab0f8eca3a (patch)
tree29db0c37649d1ee030049b090adebbc8945314dd /python
parent9509b4b00f95fb6282b6d0491d82002c9fa06579 (diff)
downloadqpid-python-027b5e3cdbf37ce50c6e7fae7872d1ab0f8eca3a.tar.gz
QPID-5790: avoid use of poll if select is monkey-patched by Eventlet/Greenthreads
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1598586 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
-rw-r--r--python/qpid/compat.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/python/qpid/compat.py b/python/qpid/compat.py
index 1fad902a31..12966c2383 100644
--- a/python/qpid/compat.py
+++ b/python/qpid/compat.py
@@ -40,10 +40,18 @@ except ImportError:
def format_exc():
return "".join(traceback.format_exception(*sys.exc_info()))
-# prefer poll() to select(), as it performs better at scale:
+# QPID-5588: prefer poll() to select(), as it allows file descriptors with
+# values > FD_SETSIZE
import select as _select_mod
-if hasattr(_select_mod, "poll"):
+try:
+ # QPID-5790: unless eventlet/greenthreads have monkey-patched the select
+ # module, as to date poll() is not properly supported by eventlet
+ import eventlet
+ _is_patched = eventlet.patcher.is_monkey_patched("select")
+except ImportError:
+ _is_patched = False
+if hasattr(_select_mod, "poll") and not _is_patched:
from select import error as SelectError
def select(rlist, wlist, xlist, timeout=None):
fd_count = 0