[New-bugs-announce] [issue38580] select()'s documentation claims only sequences are accepted, but it allows all iterables

Jakub Stasiak report at bugs.python.org
Thu Oct 24 07:08:46 EDT 2019


New submission from Jakub Stasiak <jakub+python.org at stasiak.at>:

Excerpt from the documentation:

"""This is a straightforward interface to the Unix select() system call. The first three arguments are sequences of ‘waitable objects’: either integers representing file descriptors or objects with a parameterless method named fileno() returning such an integer:"""

In reality it accepts for example dictionary key views (that's how I discovered it) due to its internal usage of PySequence_Fast, which (from https://docs.python.org/3/c-api/sequence.html#c.PySequence_Fast):

"""Return the sequence or iterable o as an object usable by the other PySequence_Fast* family of functions. If the object is not a sequence or iterable, raises TypeError with m as the message text. Returns NULL on failure."""

I made a pull request to document this behavior in select (https://github.com/python/cpython/pull/16832) but it was recommended that I create this issue because the solution may not be obvious here.

----------
components: Library (Lib)
messages: 355325
nosy: corona10, jstasiak
priority: normal
pull_requests: 16447
severity: normal
status: open
title: select()'s documentation claims only sequences are accepted, but it allows all iterables
type: behavior
versions: Python 3.5, Python 3.6, Python 3.7, Python 3.8, Python 3.9

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue38580>
_______________________________________


More information about the New-bugs-announce mailing list