bpo-46676: Make ParamSpec args and kwargs equal to themselves (GH-31203)

This commit is contained in:
Gregory Beauregard 2022-02-07 23:46:58 -08:00 committed by GitHub
parent e959dd9f5c
commit c8b62bbe46
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 19 additions and 0 deletions

View file

@ -859,6 +859,11 @@ class ParamSpecArgs(_Final, _Immutable, _root=True):
def __repr__(self):
return f"{self.__origin__.__name__}.args"
def __eq__(self, other):
if not isinstance(other, ParamSpecArgs):
return NotImplemented
return self.__origin__ == other.__origin__
class ParamSpecKwargs(_Final, _Immutable, _root=True):
"""The kwargs for a ParamSpec object.
@ -878,6 +883,11 @@ class ParamSpecKwargs(_Final, _Immutable, _root=True):
def __repr__(self):
return f"{self.__origin__.__name__}.kwargs"
def __eq__(self, other):
if not isinstance(other, ParamSpecKwargs):
return NotImplemented
return self.__origin__ == other.__origin__
class ParamSpec(_Final, _Immutable, _TypeVarLike, _root=True):
"""Parameter specification variable.