From 1dcb2cc12d447b3be226f61699d2570c921b67bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BB=D0=B5=D0=BA=D1=81=D0=B5=D0=B9?= Date: Thu, 17 Jun 2021 18:51:29 +0530 Subject: [PATCH 017/N] MINGW setup select module MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Алексей --- Modules/selectmodule.c | 6 +++--- setup.py | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index fb71e91..ad3990c 100644 --- a/Modules/selectmodule.c +++ b/Modules/selectmodule.c @@ -155,9 +155,9 @@ seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1]) 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()"); @@ -165,7 +165,7 @@ seq2set(PyObject *seq, fd_set *set, pylist fd2obj[FD_SETSIZE + 1]) } 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 --git a/setup.py b/setup.py index a15718e..7914821 100644 --- a/setup.py +++ b/setup.py @@ -906,7 +906,11 @@ class PyBuildExt(build_ext): self.missing.append('spwd') # select(2); not on ancient System V - self.add(Extension('select', ['selectmodule.c'])) + select_libs = [] + if MS_WINDOWS: + select_libs += ['ws2_32'] + self.add(Extension('select', ['selectmodule.c'], + libraries=select_libs)) # Fred Drake's interface to the Python parser self.add(Extension('parser', ['parsermodule.c'])) -- 2.33.0