diff -rupN Python-2.7.13/Modules/selectmodule.c Python-2.7.13-new/Modules/selectmodule.c
--- Python-2.7.13/Modules/selectmodule.c 2016-12-17 21:05:07.000000000 +0100
+++ Python-2.7.13-new/Modules/selectmodule.c 2017-01-21 01:46:07.423597765 +0100
@@ -107,9 +107,9 @@ seq2set(PyObject *seq, fd_set *set, pyli
v = PyObject_AsFileDescriptor( o );
if (v == -1) goto finally;
-#if defined(_MSC_VER)
+#if defined(MS_WIN32)
max = 0; /* not used for Win32 */
-#else /* !_MSC_VER */
+#else /* !MS_WIN32 */
if (!_PyIsSelectable_fd(v)) {
PyErr_SetString(PyExc_ValueError,
"filedescriptor out of range in select()");
@@ -117,7 +117,7 @@ seq2set(PyObject *seq, fd_set *set, pyli
}
if (v > max)
max = v;
-#endif /* _MSC_VER */
+#endif /* MS_WIN32 */
FD_SET(v, set);
/* add object and its file descriptor to the list */
diff -rupN Python-2.7.13/setup.py Python-2.7.13-new/setup.py
--- Python-2.7.13/setup.py 2017-01-21 01:46:07.422597776 +0100
+++ Python-2.7.13-new/setup.py 2017-01-21 01:46:07.424597754 +0100
@@ -680,7 +680,11 @@ class PyBuildExt(build_ext):
missing.append('spwd')
# select(2); not on ancient System V
- exts.append( Extension('select', ['selectmodule.c']) )
+ select_libs = []
+ if host_platform.startswith(('mingw', 'win')):
+ select_libs += ['ws2_32']
+ exts.append( Extension('select', ['selectmodule.c'],
+ libraries=select_libs) )
# Fred Drake's interface to the Python parser
exts.append( Extension('parser', ['parsermodule.c']) )