Skip to content

docs(queueutils): document IndexError for empty reads - #556

Closed
xiehuanyi wants to merge 1 commit into
mahmoud:masterfrom
xiehuanyi:docs/priority-queue-empty-exceptions
Closed

xiehuanyi wants to merge 1 commit into
mahmoud:masterfrom
xiehuanyi:docs/priority-queue-empty-exceptions

Conversation

@xiehuanyi

Copy link
Copy Markdown

The change

peek() and pop() raise IndexError on an empty queue without a default. Their docstrings currently promise KeyError, which gives callers the wrong exception to catch. Document the existing exception consistently for both methods.

Validation: 3 queue tests/doctests passed; direct checks confirmed both queue implementations raise IndexError and preserve explicit defaults.

The backstory

Earlier contribution from this account: #555. This discrepancy was found while checking the queue API documentation against its implementation; no separate issue was filed.

AI assistance

  • Harness/tooling: Codex
  • Model(s): GPT-6
  • Original prompt(s): “再改30个10分钟之内可以验证,改正然后提交的issue,提交pr哈。可以多叫几个subagent帮你搞” (Find and fix another 30 issues that can be verified within 10 minutes, and submit PRs; subagents may help.)

Copilot AI balanced review requested due to automatic review settings October 7, 2026 16:35

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@mahmoud

mahmoud commented Oct 25, 2026

Copy link
Copy Markdown
Owner

Folded into #609 (see the PR description for credit). Thanks for the report and the repro.

@mahmoud mahmoud closed this Oct 25, 2026
blebo pushed a commit to blebo/boltons that referenced this pull request Nov 1, 2026
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.

3 participants