mirror of https://github.com/python/cpython
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.
This commit is contained in:
parent
23abae621f
commit
f00ced8396
|
@ -46,7 +46,7 @@ class SelectTestCase(unittest.TestCase):
|
|||
self.assertIsNot(r, x)
|
||||
self.assertIsNot(w, x)
|
||||
|
||||
@unittest.skipUnless(hasattr(os, 'popen'), "need os.popen()")
|
||||
@support.requires_fork()
|
||||
def test_select(self):
|
||||
code = textwrap.dedent('''
|
||||
import time
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
:func:`select.select` now passes ``NULL`` to ``select`` for each empty fdset.
|
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue