bpo-31334: Fix timeout in select.poll.poll() by volans- · Pull Request #3277 · python/cpython (original) (raw)
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@berkerpeksag what if a OS defines INFTIM
different from -1
? This ensures that we set ms
to INFTIM
in that case too. I can change it to ms <= -1
if you think it's more readable.
On a side note, the documentation says only that the timeout parameter is in milliseconds, but doesn't say it must be an integer. I've noticed that passing a float works too and in the special case of passing a float in the range (-1, 0)
, that is converted to 0
by ms = _PyTime_AsMilliseconds(timeout, _PyTime_ROUND_CEILING);
. I've tested that this behaviour does not change with my patch, but is arguably the desired one.