bpo-38580: Document that select() accepts iterables, not just sequences (GH-16832)

This commit is contained in:
Jakub Stasiak 2020-05-25 09:03:48 +02:00 committed by GitHub
parent cba5031510
commit 372ee27d49
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 8 additions and 8 deletions

View File

@ -117,7 +117,7 @@ The module defines the following:
.. function:: select(rlist, wlist, xlist[, timeout]) .. function:: select(rlist, wlist, xlist[, timeout])
This is a straightforward interface to the Unix :c:func:`select` system call. This is a straightforward interface to the Unix :c:func:`select` system call.
The first three arguments are sequences of 'waitable objects': either The first three arguments are iterables of 'waitable objects': either
integers representing file descriptors or objects with a parameterless method integers representing file descriptors or objects with a parameterless method
named :meth:`~io.IOBase.fileno` returning such an integer: named :meth:`~io.IOBase.fileno` returning such an integer:
@ -126,7 +126,7 @@ The module defines the following:
* *xlist*: wait for an "exceptional condition" (see the manual page for what * *xlist*: wait for an "exceptional condition" (see the manual page for what
your system considers such a condition) your system considers such a condition)
Empty sequences are allowed, but acceptance of three empty sequences is Empty iterables are allowed, but acceptance of three empty iterables is
platform-dependent. (It is known to work on Unix but not on Windows.) The platform-dependent. (It is known to work on Unix but not on Windows.) The
optional *timeout* argument specifies a time-out as a floating point number optional *timeout* argument specifies a time-out as a floating point number
in seconds. When the *timeout* argument is omitted the function blocks until in seconds. When the *timeout* argument is omitted the function blocks until
@ -141,7 +141,7 @@ The module defines the following:
single: socket() (in module socket) single: socket() (in module socket)
single: popen() (in module os) single: popen() (in module os)
Among the acceptable object types in the sequences are Python :term:`file Among the acceptable object types in the iterables are Python :term:`file
objects <file object>` (e.g. ``sys.stdin``, or objects returned by objects <file object>` (e.g. ``sys.stdin``, or objects returned by
:func:`open` or :func:`os.popen`), socket objects returned by :func:`open` or :func:`os.popen`), socket objects returned by
:func:`socket.socket`. You may also define a :dfn:`wrapper` class yourself, :func:`socket.socket`. You may also define a :dfn:`wrapper` class yourself,

View File

@ -8,7 +8,7 @@ PyDoc_STRVAR(select_select__doc__,
"\n" "\n"
"Wait until one or more file descriptors are ready for some kind of I/O.\n" "Wait until one or more file descriptors are ready for some kind of I/O.\n"
"\n" "\n"
"The first three arguments are sequences of file descriptors to be waited for:\n" "The first three arguments are iterables of file descriptors to be waited for:\n"
"rlist -- wait until ready for reading\n" "rlist -- wait until ready for reading\n"
"wlist -- wait until ready for writing\n" "wlist -- wait until ready for writing\n"
"xlist -- wait for an \"exceptional condition\"\n" "xlist -- wait for an \"exceptional condition\"\n"
@ -1215,4 +1215,4 @@ exit:
#ifndef SELECT_KQUEUE_CONTROL_METHODDEF #ifndef SELECT_KQUEUE_CONTROL_METHODDEF
#define SELECT_KQUEUE_CONTROL_METHODDEF #define SELECT_KQUEUE_CONTROL_METHODDEF
#endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */ #endif /* !defined(SELECT_KQUEUE_CONTROL_METHODDEF) */
/*[clinic end generated code: output=26bb05e5fba2bfd1 input=a9049054013a1b77]*/ /*[clinic end generated code: output=029f23fbe000d7f7 input=a9049054013a1b77]*/

View File

@ -239,7 +239,7 @@ select.select
Wait until one or more file descriptors are ready for some kind of I/O. Wait until one or more file descriptors are ready for some kind of I/O.
The first three arguments are sequences of file descriptors to be waited for: The first three arguments are iterables of file descriptors to be waited for:
rlist -- wait until ready for reading rlist -- wait until ready for reading
wlist -- wait until ready for writing wlist -- wait until ready for writing
xlist -- wait for an "exceptional condition" xlist -- wait for an "exceptional condition"
@ -264,7 +264,7 @@ descriptors can be used.
static PyObject * static PyObject *
select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist, select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist,
PyObject *xlist, PyObject *timeout_obj) PyObject *xlist, PyObject *timeout_obj)
/*[clinic end generated code: output=2b3cfa824f7ae4cf input=177e72184352df25]*/ /*[clinic end generated code: output=2b3cfa824f7ae4cf input=e467f5d68033de00]*/
{ {
#ifdef SELECT_USES_HEAP #ifdef SELECT_USES_HEAP
pylist *rfd2obj, *wfd2obj, *efd2obj; pylist *rfd2obj, *wfd2obj, *efd2obj;
@ -320,7 +320,7 @@ select_select_impl(PyObject *module, PyObject *rlist, PyObject *wlist,
} }
#endif /* SELECT_USES_HEAP */ #endif /* SELECT_USES_HEAP */
/* Convert sequences to fd_sets, and get maximum fd number /* Convert iterables to fd_sets, and get maximum fd number
* propagates the Python exception set in seq2set() * propagates the Python exception set in seq2set()
*/ */
rfd2obj[0].sentinel = -1; rfd2obj[0].sentinel = -1;