bpo-46244: Remove __slots__ from typing.TypeVar, .ParamSpec (#30444)

* add missing __slots__ to typing._TypeVarLike

* add news entry

* remove slots from _TypeVarLike base classes

* cleanup diff

* fix broken link in blurb
This commit is contained in:
Arie Bovenberg 2022-01-11 00:43:39 +01:00 committed by GitHub
parent 6223cbf86a
commit 081a214008
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 6 deletions

View file

@ -805,9 +805,6 @@ class TypeVar( _Final, _Immutable, _TypeVarLike, _root=True):
Note that only type variables defined in global scope can be pickled.
"""
__slots__ = ('__name__', '__bound__', '__constraints__',
'__covariant__', '__contravariant__', '__dict__')
def __init__(self, name, *constraints, bound=None,
covariant=False, contravariant=False):
self.__name__ = name
@ -907,9 +904,6 @@ class ParamSpec(_Final, _Immutable, _TypeVarLike, _root=True):
be pickled.
"""
__slots__ = ('__name__', '__bound__', '__covariant__', '__contravariant__',
'__dict__')
@property
def args(self):
return ParamSpecArgs(self)

View file

@ -0,0 +1,2 @@
Removed ``__slots__`` from :class:`typing.ParamSpec` and :class:`typing.TypeVar`.
They served no purpose. Patch by Arie Bovenberg.