summaryrefslogtreecommitdiffstats
path: root/Lib/typing.py
diff options
context:
space:
mode:
authorGregory Beauregard <greg@greg.red>2022-02-08 08:41:13 (GMT)
committerGitHub <noreply@github.com>2022-02-08 08:41:13 (GMT)
commitcbdcae5ab90710e8d82c213f3798af1154670ff9 (patch)
tree3bb048bde0cf2620f530b58a04ba08b213bac5d7 /Lib/typing.py
parent9539400390494f4930c245b3f98453592f4a1a8c (diff)
downloadcpython-cbdcae5ab90710e8d82c213f3798af1154670ff9.zip
cpython-cbdcae5ab90710e8d82c213f3798af1154670ff9.tar.gz
cpython-cbdcae5ab90710e8d82c213f3798af1154670ff9.tar.bz2
[3.10] bpo-46676: Make ParamSpec args and kwargs equal to themselves (GH-31203) (GH-31210)
(cherry picked from commit c8b62bbe46e20d4b6dd556f2fa85960d1269aa45) Co-authored-by: Gregory Beauregard <greg@greg.red>
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 7743c7f..135ca58 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -830,6 +830,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.
@@ -849,6 +854,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.