Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Passing timeout=0 to poll() behaves like poll_forever #26

Open
ami-friedman opened this issue Jun 2, 2022 · 0 comments
Open

Passing timeout=0 to poll() behaves like poll_forever #26

ami-friedman opened this issue Jun 2, 2022 · 0 comments

Comments

@ami-friedman
Copy link

Steps to reproduce:

Call poll() with timeout = 0

Expected:
poll() should exit immediately after one attempt (at least this is how poll() behaves in linux)

Actual:
poll() continues until condition is met (basically as if poll_forever was set to True)

This seems to be the problematic line:
max_time = time.time() + timeout if timeout else None

In Python 0 evaluates as False. i think a more correct code would be:
max_time = time.time() + timeout if timeout is not None else None

If this IS intentional, I think it's worth updating the docs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant