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

Generic class with broken __eq__ cannot be specialized #119972

Open
JelleZijlstra opened this issue Jun 3, 2024 · 0 comments
Open

Generic class with broken __eq__ cannot be specialized #119972

JelleZijlstra opened this issue Jun 3, 2024 · 0 comments
Assignees
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes topic-typing type-bug An unexpected behavior, bug, or error

Comments

@JelleZijlstra
Copy link
Member

JelleZijlstra commented Jun 3, 2024

Bug report

Bug description:

This test case currently fails:

    def test_buggy_eq(self):
        class BrokenEq(abc.ABCMeta):
            def __eq__(self, other):
                raise TypeError("I'm broken")

        class G(Generic[T], metaclass=BrokenEq):
            pass

        alias = G[int]
        self.assertIs(get_origin(alias), G)
        self.assertEqual(get_args(alias), (int,))

See python/typing_extensions#422 for a real-world example.

CPython versions tested on:

CPython main branch

Operating systems tested on:

macOS

Linked PRs

@JelleZijlstra JelleZijlstra added type-bug An unexpected behavior, bug, or error topic-typing 3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes labels Jun 3, 2024
@JelleZijlstra JelleZijlstra self-assigned this Jun 3, 2024
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue Jun 3, 2024
JelleZijlstra added a commit to JelleZijlstra/cpython that referenced this issue Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and security fixes 3.13 bugs and security fixes 3.14 new features, bugs and security fixes topic-typing type-bug An unexpected behavior, bug, or error
Projects
None yet
Development

No branches or pull requests

1 participant