Skip to content

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

Closed

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

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    stdlibStandard Library Python modules in the Lib/ directory
    on Aug 27, 2026
  2. changed the title [-]Pure Python SimpleQueue.get() raises ValueError when block is false and timeout is given[/-] [+]Pure Python `SimpleQueue.get()` raises `ValueError` when block is false and timeout is given[/+] on Aug 27, 2026
  3. added 3 commits that reference this issue on Aug 27, 2026
  4. added a commit that references this issue on Aug 27, 2026
  5. added a commit that references this issue on Oct 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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