Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert __eq__ removal #8487

Merged
merged 1 commit into from
Aug 4, 2022
Merged

Revert __eq__ removal #8487

merged 1 commit into from
Aug 4, 2022

Conversation

sobolevn
Copy link
Member

@sobolevn sobolevn 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:

class A:
    def __eq__(self, o: object) -> bool: ...

class B: ...

if A() == 1:  # ok
    ...

if B() == 1: # error: Non-overlapping equality check (left operand type: "B", right operand type: "Literal[1]")
    ...

Refs #8483

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

github-actions bot commented Aug 4, 2022

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

@srittau srittau merged commit a03e8b4 into python:master Aug 4, 2022
@hauntsaninja
Copy link
Collaborator

Thanks for catching this!

Sign up for free to 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