Repository navigation
Fix comparisons between messages and other types - #1483
Open
wozhenbang2004 wants to merge 2 commits into
Open
wozhenbang2004 wants to merge 2 commits into
wozhenbang2004 wants to merge 2 commits into
Conversation
Return NotImplemented so Python can apply reflected comparisons and equality or ordering fallbacks.
Cover unrelated operands in both directions and Python reflected equality.
This branch has not been deployed
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.
Messagecomparison methods currently accessother.ideven for unrelated objects. Comparing a message withNoneraisesAttributeError; this also breaks catalog inspection withdill.detect.baditems, as reported in sphinx-doc/sphinx#12064.Return
NotImplementedfor non-Message operands so Python can perform reflected comparisons and apply its normal equality/ordering fallbacks. Keep message-to-message comparison unchanged. Regression tests cover unrelated operands in both directions and reflected equality.Validation on Python 3.12: 21 regression cases fail before the change and pass afterward;
make test PYTEST_FLAGS='-q'with generated CLDR 49 data reports 8,241 passed, 3 skipped, 2 xfailed. All pre-commit hooks pass. The originaldill.detect.baditems(read_po(...))operation completes successfully.Related to sphinx-doc/sphinx#12064. The open sorting optimization #1438 does not modify these comparison methods.
AI assistance: ChatGPT (GPT-6 Astra Pro) prepared this patch, tests, and description.