mirror of
https://github.com/python/cpython.git
synced 2025-08-02 08:02:56 +00:00
[3.10] bpo-46676: Make ParamSpec args and kwargs equal to themselves (GH-31203) (GH-31210)
(cherry picked from commit c8b62bbe46
)
Co-authored-by: Gregory Beauregard <greg@greg.red>
This commit is contained in:
parent
9539400390
commit
cbdcae5ab9
3 changed files with 19 additions and 0 deletions
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue