summaryrefslogtreecommitdiffstats
path: root/Lib/typing.py
diff options
context:
space:
mode:
authorGregory Beauregard <greg@greg.red>2022-02-08 07:46:58 (GMT)
committerGitHub <noreply@github.com>2022-02-08 07:46:58 (GMT)
commitc8b62bbe46e20d4b6dd556f2fa85960d1269aa45 (patch)
tree34296f484dcc9a4a346de4a93b22b0578c2d4703 /Lib/typing.py
parente959dd9f5c1d8865d4e10c49eb30ee0a4fe2735d (diff)
downloadcpython-c8b62bbe46e20d4b6dd556f2fa85960d1269aa45.zip
cpython-c8b62bbe46e20d4b6dd556f2fa85960d1269aa45.tar.gz
cpython-c8b62bbe46e20d4b6dd556f2fa85960d1269aa45.tar.bz2
bpo-46676: Make ParamSpec args and kwargs equal to themselves (GH-31203)
Diffstat (limited to 'Lib/typing.py')
-rw-r--r--Lib/typing.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/typing.py b/Lib/typing.py
index d1d5130..0ee5c85 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -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.