-
Notifications
You must be signed in to change notification settings - Fork 87
Closed
Description
I wanted to test the latest release to start migrating my tool to Python 3 (thanks a lot for adding Py3 support!) and found that both clush and ClusterShell as a library fails on macOS (and other BSDs) when not setting a timeout, with ERROR: [Errno 22] Invalid argument.
After digging a bit I discovered that:
- in Python 3 the
Engine.Factory.PreferredEnginefactory returns anEnginePollon macOS, while on Python 2 it was returning anEngineSelectbecausepoll()was not supported. - when polling for events in
Engine.Poll.EnginePoll.runloop(), the timeout passed to thepoll.poll()method istimeo * 1000.0 + 1.0, and when the timeout is not specified,timeo = -1, hence the passed timeout is-999.0. - Python passes the timeout parameter of
select.poll.poll([timeout])basically as-is down to thepoll()system call - On macOS and other BSDs the
poll()system call throws an error on arbitrary negative values. Only non-negative integers and-1(or the value ofINFTIMif defined) are accepted.
I've already opened an issue to Python [1] and sent a PR to hopefully fix it [2], but I'll follow up with a PR to ClusterShell too to workaround this issue passing directly -1 to the poll() method.
[1] https://bugs.python.org/issue31334
[2] python/cpython/pull/3277