Skip to content

Fix min/max skipping first iterator item with default and no key - #2137

Merged
slozier merged 1 commit into
IronLanguages:mainfrom
slozier:minmax
Nov 3, 2026
Merged

slozier merged 1 commit into
IronLanguages:mainfrom
slozier:minmax

Conversation

@slozier

@slozier slozier commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Fixes min/max skipping the first item of an iterator when default= is given without a key function, for example:

min(iter([0, 1, 2]), default=None)

incorrectly resulted in 1.

Also fixes the two-argument forms returning the second item on ties (e.g. max(1, 1.0) gave 1.0).

Additional changes are code cleanup and lining up error messages with CPython.

@slozier
slozier merged commit 468a22d into IronLanguages:main Nov 3, 2026
35 checks passed
@slozier
slozier deleted the minmax branch November 3, 2026 22:57
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.

1 participant