summaryrefslogtreecommitdiffstats
path: root/Modules/selectmodule.c
diff options
context:
space:
mode:
authorChristian Heimes <christian@python.org>2022-03-14 13:40:28 (GMT)
committerGitHub <noreply@github.com>2022-03-14 13:40:28 (GMT)
commitf00ced8396f2d7683e58b9d5ebbf5797992bf477 (patch)
treee1c82c567bab35043f594f54f756a0b0432ddd89 /Modules/selectmodule.c
parent23abae621f579014eb29d5c6621f031c8a1a4057 (diff)
downloadcpython-f00ced8396f2d7683e58b9d5ebbf5797992bf477.zip
cpython-f00ced8396f2d7683e58b9d5ebbf5797992bf477.tar.gz
cpython-f00ced8396f2d7683e58b9d5ebbf5797992bf477.tar.bz2
bpo-40280: select: Use NULL for empty fdset (GH-31865)
wasm32-emscripten does not support exceptfds and requires NULL. Python now passes NULL instead of a fdset pointer when the input list is empty. This works fine on all platforms and might even be a tiny bit faster.
Diffstat (limited to 'Modules/selectmodule.c')
-rw-r--r--Modules/selectmodule.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c
index 1a5a632..5c36eaa 100644
--- a/Modules/selectmodule.c
+++ b/Modules/selectmodule.c
@@ -330,7 +330,12 @@ select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist,
do {
Py_BEGIN_ALLOW_THREADS
errno = 0;
- n = select(max, &ifdset, &ofdset, &efdset, tvp);
+ n = select(
+ max,
+ imax ? &ifdset : NULL,
+ omax ? &ofdset : NULL,
+ emax ? &efdset : NULL,
+ tvp);
Py_END_ALLOW_THREADS
if (errno != EINTR)