Skip to content

Commit

Permalink
selectmodule: add support for MINGW
Browse files Browse the repository at this point in the history
  • Loading branch information
naveen521kk authored and lazka committed Aug 25, 2023
1 parent 43bbdbf commit e85c2f9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 3 additions & 3 deletions Modules/selectmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -146,17 +146,17 @@ 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()");
goto finally;
}
if (v > max)
max = v;
#endif /* _MSC_VER */
#endif /* MS_WIN32 */
FD_SET(v, set);

/* add object and its file descriptor to the list */
Expand Down
4 changes: 3 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -974,7 +974,9 @@ def detect_simple_extensions(self):
self.addext(Extension('spwd', ['spwdmodule.c']))

# select(2); not on ancient System V
self.addext(Extension('select', ['selectmodule.c']))
self.addext(Extension(
'select', ['selectmodule.c'],
libraries=(['ws2_32'] if MS_WINDOWS else None)))

# Memory-mapped files (also works on Win32).
self.addext(Extension('mmap', ['mmapmodule.c']))
Expand Down

0 comments on commit e85c2f9

Please sign in to comment.