[Python-checkins] r42339 - in python/branches/release24-maint: Modules/_ssl.c Modules/socketmodule.c PC/pyconfig.h
neal.norwitz
python-checkins at python.org
Sun Feb 12 22:07:21 CET 2006
Author: neal.norwitz
Date: Sun Feb 12 22:07:17 2006
New Revision: 42339
Modified:
python/branches/release24-maint/Modules/_ssl.c
python/branches/release24-maint/Modules/socketmodule.c
python/branches/release24-maint/PC/pyconfig.h
Log:
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.
Modified: python/branches/release24-maint/Modules/_ssl.c
==============================================================================
--- python/branches/release24-maint/Modules/_ssl.c (original)
+++ python/branches/release24-maint/Modules/_ssl.c Sun Feb 12 22:07:17 2006
@@ -377,8 +377,10 @@
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;
Modified: python/branches/release24-maint/Modules/socketmodule.c
==============================================================================
--- python/branches/release24-maint/Modules/socketmodule.c (original)
+++ python/branches/release24-maint/Modules/socketmodule.c Sun Feb 12 22:07:17 2006
@@ -391,7 +391,14 @@
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)
Modified: python/branches/release24-maint/PC/pyconfig.h
==============================================================================
--- python/branches/release24-maint/PC/pyconfig.h (original)
+++ python/branches/release24-maint/PC/pyconfig.h Sun Feb 12 22:07:17 2006
@@ -562,4 +562,9 @@
/* Define if you have the thread library (-lthread). */
/* #undef HAVE_LIBTHREAD */
+
+/* WinSock does not use a bitmask in select, and uses
+ socket handles greater than FD_SETSIZE */
+#define Py_SOCKET_FD_CAN_BE_GE_FD_SETSIZE
+
#endif /* !Py_CONFIG_H */
More information about the Python-checkins
mailing list