Skip to content

Conversation

@sobolevn
Copy link
Member

@sobolevnsobolevn commented Aug 4, 2022

Because __eq__ is treated specially by mypy when strict_equality is turned on.
Without __eq__ on a type, mypy raises this error:

classA: def__eq__(self, o: object) ->bool: ... classB: ... ifA() ==1: # ok ... ifB() ==1: # error: Non-overlapping equality check (left operand type: "B", right operand type: "Literal[1]") ...

Refs #8483

@sobolevnsobolevn changed the title Revert __eq__ removal, refs #8483Revert __eq__ removalAug 4, 2022
@github-actions
Copy link
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittausrittau merged commit a03e8b4 into python:masterAug 4, 2022
@hauntsaninja
Copy link
Collaborator

Thanks for catching this!

Sign up for freeto 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.

3 participants

@sobolevn@hauntsaninja@srittau