From f00ced8396f2d7683e58b9d5ebbf5797992bf477 Mon Sep 17 00:00:00 2001 From: Christian Heimes Date: Mon, 14 Mar 2022 15:40:28 +0200 Subject: 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. --- Modules/selectmodule.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Modules') diff --git a/Modules/selectmodule.c b/Modules/selectmodule.c index 1a5a63249c..5c36eaaede 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) -- cgit v1.2.1