Repository navigation
Honor falsey callable keys in redundant - #554
Closed
Gambit-Checkmate wants to merge 1 commit into
Closed
Gambit-Checkmate wants to merge 1 commit into
Gambit-Checkmate wants to merge 1 commit into
Conversation
This was referenced Oct 8, 2026
Saadia751
reviewed
Oct 14, 2026
Saadia751
left a comment
There was a problem hiding this comment.
A falsey callable now works with unhashable dictionary inputs as well as ordinary values. I checked duplicate transformed keys with and without groups=True; the complete group keeps the first occurrence and its later matches, while the default result retains the first redundant occurrence.
Checked 3d93b2d3b181 with standalone Python 3.12.14 checks (3 passing assertions). I haven't run the full upstream suite.
Owner
|
Folded into #609 (see the PR description for credit). Thanks for the report and the repro. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The change
Honor callable
redundantkeys regardless of their boolean value. The function already accepts them in validation, but a subsequent truthiness check silently bypasses them, producing incorrect duplicates and raising TypeError on unhashable values. Distinguish an omitted key (None) from a supplied key, and document that contract.Three regressions cover falsey
__bool__callables in both result modes, one call per item with generator input, and a zero-length callable normalizing unhashable lists. All three fail before the patch;python -m pytest --doctest-modules boltons tests -qpasses after it: 681 tests and 12 subtests on Windows/Python 3.13.13. No runtime dependencies added.The backstory
Like #551 and #552, this was investigated by Codex at the account owner's request to contribute tested fixes to established projects. This is a separate bug from sorting-key evaluation:
redundantdisagrees with its documented complementuniqueon a valid callable input. I do not claim personal human usage experience; the reproduction and regressions were run against current master.AI assistance
Fixes #553.
GitHub Actions is awaiting maintainer approval for this external contribution (action_required): https://github.com/mahmoud/boltons/actions/runs/37569645832 . Local full validation passed; hosted documentation build is pending.