[ty] Add a diagnostic for @functools.total_ordering without a defined comparison method#22183
Merged
charliermarsh merged 1 commit intomainfrom Jan 6, 2026
Merged
Conversation
02b19b3 to
bdf642d
Compare
Diagnostic diff on typing conformance testsNo changes detected when running ty on typing conformance tests ✅ |
|
52e7d6f to
240fc44
Compare
bdf642d to
e09082e
Compare
f50ca7a to
815e631
Compare
e09082e to
7f10523
Compare
7f10523 to
c91a077
Compare
RasmusNygren
pushed a commit
to RasmusNygren/ruff
that referenced
this pull request
Jan 6, 2026
…ed comparison method (astral-sh#22183) ## Summary This raises a `ValueError` at runtime: ```python from functools import total_ordering @total_ordering class NoOrdering: def __eq__(self, other: object) -> bool: return True ``` Specifically: ``` Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/functools.py", line 193, in total_ordering raise ValueError('must define at least one ordering operation: < > <= >=') ValueError: must define at least one ordering operation: < > <= >= ``` See: astral-sh/ty#1202.
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.
Summary
This raises a
ValueErrorat runtime:Specifically:
See: astral-sh/ty#1202.