Skip to content

Honor false-valued sort comparators - #317

Merged
dgilland merged 2 commits into
dgilland:developfrom
harbinresearcher:codex/honor-falsey-sort-comparators
Oct 17, 2026
Merged

dgilland merged 2 commits into
dgilland:developfrom
harbinresearcher:codex/honor-falsey-sort-comparators

Conversation

@harbinresearcher

Copy link
Copy Markdown
Contributor

Fixes #316.

sort silently ignores a callable comparator whose truth value is false. The same presence checks also bypass the documented comparator/key conflict when either supplied callable is false-valued.

Use explicit None checks for the two guards. Six regression cases cover ascending/reverse behavior with a false-valued comparator, all three false-valued conflict combinations, in-place identity, and a false-valued key supplied alone. Include a changelog entry and the contributor credit required by CONTRIBUTING.

Validation:

  • Before the fix, five new cases fail and the independent-key control passes.
  • Windows CPython 3.12.14: pristine 2476 passed; patched 2482 passed; both 100% configured coverage.
  • Linux CPython 3.10.22, 3.11.17, 3.12.15, 3.13.16 and 3.14.8: pristine 2476 passed and patched 2482 passed on every version, all with 100% configured coverage.
  • Official inv ci on Linux 3.12.15 passed: sdist/wheel build, Sphinx with warnings treated as errors, Ruff format/lint, mypy, generated chaining-type consistency, and all tests. Windows mypy and git diff --check passed too.

Disclosure: this contribution was prepared and checked by an AI coding agent. The reproduction comes from local source inspection, not a reported production incident. Automated code review is not human maintainer approval.

@coveralls

coveralls commented Oct 17, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 100.0%. remained the same — harbinresearcher:codex/honor-falsey-sort-comparators into dgilland:develop

@dgilland
dgilland merged commit 9c30ab6 into dgilland:develop Oct 17, 2026
5 checks passed
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.

sort ignores false-valued comparator callables

3 participants