Skip to content

[refurb] Document FURB192 exception change for empty sequences#25317

Merged
ntBre merged 1 commit into
astral-sh:mainfrom
adityasingh2400:docs-furb192-empty-sequence
May 22, 2026
Merged

[refurb] Document FURB192 exception change for empty sequences#25317
ntBre merged 1 commit into
astral-sh:mainfrom
adityasingh2400:docs-furb192-empty-sequence

Conversation

@adityasingh2400

Copy link
Copy Markdown
Contributor

sorted([])[0] raises IndexError, but min([]) and max([]) raise ValueError. Code that catches one specific exception type breaks after the autofix, so the rule's fix-safety section now calls this out alongside the existing tie-breaking note.

Closes #16964

`min([])` and `max([])` raise `ValueError`, while `sorted([])[0]`
raises `IndexError`. Code that catches one specific exception type
breaks after the autofix, so the rule documentation now calls this
out alongside the existing fix-safety note about tie-breaking.

Closes astral-sh#16964
@astral-sh-bot astral-sh-bot Bot requested a review from ntBre May 22, 2026 12:32
@astral-sh-bot

astral-sh-bot Bot commented May 22, 2026

Copy link
Copy Markdown

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@ntBre ntBre added the documentation Improvements or additions to documentation label May 22, 2026
@ntBre ntBre merged commit 0df5488 into astral-sh:main May 22, 2026
45 checks passed
thejchap pushed a commit to thejchap/ruff that referenced this pull request May 23, 2026
…stral-sh#25317)

`sorted([])[0]` raises `IndexError`, but `min([])` and `max([])` raise
`ValueError`. Code that catches one specific exception type breaks after
the autofix, so the rule's fix-safety section now calls this out
alongside the existing tie-breaking note.

Closes astral-sh#16964
anishgirianish pushed a commit to anishgirianish/ruff that referenced this pull request May 28, 2026
…stral-sh#25317)

`sorted([])[0]` raises `IndexError`, but `min([])` and `max([])` raise
`ValueError`. Code that catches one specific exception type breaks after
the autofix, so the rule's fix-safety section now calls this out
alongside the existing tie-breaking note.

Closes astral-sh#16964
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

document side effect of FURB192

2 participants