Repository navigation
Conversation
FanWu-ai
marked this pull request as ready for review
October 21, 2026 22:20
Owner
|
Folded into #609 (see the PR description for credit). Thanks for the report and the repro. |
blebo
pushed a commit
to blebo/boltons
that referenced
this pull request
Nov 1, 2026
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
Fix false equality between OrderedMultiDict instances that have different numbers of trailing
(None, None)entries.OMD([(None, None)]) == OMD([(None, None), (None, None)])currently returns True:lencounts distinct keys, and the subsequentzip_longestuses a real(None, None)pair as padding. The post-loop exhaustion check cannot distinguish these lengths becausezip_longesthas consumed both iterators.Use the existing private sentinel as padding and detect exhaustion before unpacking each pair. Apply the same fix to the embedded OrderedMultiDict implementation in urlutils. Tests cover both comparison directions, repeated trailing entries, equal controls, FastIterOrderedMultiDict and QueryParamDict.
Validation on Python 3.12.14:
tox -e py312: baseline 678 passed; fixed 681 passed.git diff --check: passed.Searched existing issues and PRs for equality, OrderedMultiDict and zip_longest. #404 fixes comparison to plain mappings and #420 proposes query parameter ordering semantics; neither addresses this exhaustion collision.
The backstory
Previous contribution: #571. This issue was found during a review of the multimap's equality comparison, not from a production incident.
AI assistance