@@ -35,12 +35,15 @@ Methods
3535
3636 Register *obj * for polling. *eventmask * is logical OR of:
3737
38- * ``select.POLLIN `` - data available for reading
39- * ``select.POLLOUT `` - more data can be written
40- * ``select.POLLERR `` - error occurred
41- * ``select.POLLHUP `` - end of stream/connection termination detected
38+ * `uselect.POLLIN ` - data available for reading
39+ * `uselect.POLLOUT ` - more data can be written
4240
43- *eventmask * defaults to ``select.POLLIN | select.POLLOUT ``.
41+ Note that flags like `uselect.POLLHUP ` and `uselect.POLLERR ` are
42+ *not * valid as input eventmask (these are unsolicited events which
43+ will be returned from `poll() ` regardless of whether they are asked
44+ for). This semantics is per POSIX.
45+
46+ *eventmask * defaults to ``uselect.POLLIN | uselect.POLLOUT ``.
4447
4548.. method :: poll.unregister(obj)
4649
@@ -52,15 +55,21 @@ Methods
5255
5356.. method :: poll.poll(timeout=-1)
5457
55- Wait for at least one of the registered objects to become ready, with optional
56- timeout in milliseconds (if *timeout * arg is not specified or -1, there is no
57- timeout). Returns list of (``obj ``, ``event ``, ...) tuples, ``event `` element specifies
58- which events happened with a stream and is a combination of ``select.POLL* ``
59- constants described above. There may be other elements in tuple, depending
60- on a platform and version, so don't assume that its size is 2. In case of
61- timeout, an empty list is returned.
62-
63- Timeout is in milliseconds.
58+ Wait for at least one of the registered objects to become ready or have an
59+ exceptional condition, with optional timeout in milliseconds (if *timeout *
60+ arg is not specified or -1, there is no timeout).
61+
62+ Returns list of (``obj ``, ``event ``, ...) tuples. There may be other elements in
63+ tuple, depending on a platform and version, so don't assume that its size is 2.
64+ The ``event `` element specifies which events happened with a stream and
65+ is a combination of ``uselect.POLL* `` constants described above. Note that
66+ flags `uselect.POLLHUP ` and `uselect.POLLERR ` can be returned at any time
67+ (even if were not asked for), and must be acted on accordingly (the
68+ corresponding stream unregistered from poll and likely closed), because
69+ otherwise all further invocations of `poll() ` may return immediately with
70+ these flags set for this stream again.
71+
72+ In case of timeout, an empty list is returned.
6473
6574 .. admonition :: Difference to CPython
6675 :class: attention
0 commit comments