Generic class with broken `__eq__` cannot be specialized
Open
@JelleZijlstra is already working on this.
Since Jun 3, 2024.
3.12
3.13
3.14
topic-typing
type-bug
- Dominant language
- Python
- Stars
- 77.2k
- Forks
- 36k
- PR merge metrics
- PR metrics pending
Description
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
- gh-119973
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.