Skip to content

Treat a zero timeout as immediate in queues and locks#3621

Open
SAY-5 wants to merge 1 commit into
tornadoweb:masterfrom
SAY-5:fix-zero-timeout
Open

Treat a zero timeout as immediate in queues and locks#3621
SAY-5 wants to merge 1 commit into
tornadoweb:masterfrom
SAY-5:fix-zero-timeout

Conversation

@SAY-5
Copy link
Copy Markdown

@SAY-5 SAY-5 commented May 13, 2026

A timeout of 0 or timedelta(0) was treated as no timeout because of a falsy check, so Queue.get/Queue.put (and Condition.wait/Semaphore.acquire) would wait indefinitely instead of timing out immediately. Switched the checks to timeout is not None and added a regression test.

Closes #3271

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

Successfully merging this pull request may close these issues.

Queue.get(timeout) waits indefinitly for timedelta of zero seconds

1 participant