Skip to content

Pure Python SimpleQueue.get() raises ValueError when block is false and timeout is given #156476

Description

@aisk

The docs for SimpleQueue.get() say that timeout is ignored when block is false. The C version does that, but the pure Python version passes timeout to threading.Semaphore.acquire() and fails:

>>> from queue import _PySimpleQueue
>>> _PySimpleQueue().get(block=False, timeout=1)
Traceback (most recent call last):
  ...
ValueError: can't specify timeout for non-blocking acquire

The C version raises Empty here.

A PR is on the way.

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions