Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork32.2k
gh-119972: typing: Fix specialization of generic with broken __eq__#119973
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Changes fromall commits
File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
- Loading branch information
Uh oh!
There was an error while loading.Please reload this page.
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -5191,6 +5191,18 @@ class B(Generic[T]): | ||||||
self.assertEqual(A[T], A[T]) | ||||||
self.assertNotEqual(A[T], B[T]) | ||||||
def test_buggy_eq(self): | ||||||
class BrokenEq(abc.ABCMeta): | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others.Learn more. Doesn't need to be Suggested change
| ||||||
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,)) | ||||||
def test_multiple_inheritance(self): | ||||||
class A(Generic[T, VT]): | ||||||
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Fix specialization of :class:`typing.Generic` class with a broken ``__eq__`` | ||
method. Patch by Jelle Zijlstra. |
Uh oh!
There was an error while loading.Please reload this page.