summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorNeal Norwitz <nnorwitz@gmail.com>2006-02-12 21:07:17 (GMT)
committerNeal Norwitz <nnorwitz@gmail.com>2006-02-12 21:07:17 (GMT)
commit3273cb5eee505944f0bcce6abf8d1a6d5ff14e9c (patch)
tree08875df83630fe286c21876bac465b0eb0222287 /Modules
parent6fc1da15fec6ae8bd88e702f7ba83547a597047c (diff)
downloadcpython-3273cb5eee505944f0bcce6abf8d1a6d5ff14e9c.zip
cpython-3273cb5eee505944f0bcce6abf8d1a6d5ff14e9c.tar.gz
cpython-3273cb5eee505944f0bcce6abf8d1a6d5ff14e9c.tar.bz2
Backport r42314 which fixed Windows breakage when checking that socket
descriptors fit in fd_set. Introduce Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE. Proposed by Tim Peters implemented by Martin von Loewis.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/_ssl.c2
-rw-r--r--Modules/socketmodule.c7
2 files changed, 9 insertions, 0 deletions
diff --git a/Modules/_ssl.c b/Modules/_ssl.c
index 23e7538..fdfaabc 100644
--- a/Modules/_ssl.c
+++ b/Modules/_ssl.c
@@ -377,8 +377,10 @@ check_socket_and_wait_for_timeout(PySocketSockObject *s, int writing)
return SOCKET_HAS_BEEN_CLOSED;
/* Guard against socket too large for select*/
+#ifndef Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE
if (s->sock_fd >= FD_SETSIZE)
return SOCKET_INVALID;
+#endif
/* Construct the arguments to select */
tv.tv_sec = (int)s->sock_timeout;
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index e0af01a..0efa947 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -391,7 +391,14 @@ static int taskwindow;
static PyTypeObject sock_type;
/* Can we call select() with this socket without a buffer overrun? */
+#ifdef Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE
+/* Platform can select file descriptors beyond FD_SETSIZE */
+#define IS_SELECTABLE(s) 1
+#else
+/* POSIX says selecting file descriptors beyond FD_SETSIZE
+ has undefined behaviour. */
#define IS_SELECTABLE(s) ((s)->sock_fd < FD_SETSIZE)
+#endif
static PyObject*
select_error(void)