diff options
author | Arie Bovenberg <a.c.bovenberg@gmail.com> | 2022-01-10 23:43:39 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-10 23:43:39 (GMT) |
commit | 081a2140083680ffc309e53699aea29e71760d70 (patch) | |
tree | 278a929f6309e50ff8565cb53967b17b0467e808 | |
parent | 6223cbf86ad7d5e6d12f9747e5a9cf1d8c72bdc8 (diff) | |
download | cpython-081a2140083680ffc309e53699aea29e71760d70.zip cpython-081a2140083680ffc309e53699aea29e71760d70.tar.gz cpython-081a2140083680ffc309e53699aea29e71760d70.tar.bz2 |
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
-rw-r--r-- | Lib/typing.py | 6 | ||||
-rw-r--r-- | Misc/NEWS.d/next/Library/2022-01-06-21-31-14.bpo-46244.hjyfJj.rst | 2 |
2 files changed, 2 insertions, 6 deletions
diff --git a/Lib/typing.py b/Lib/typing.py index ae1dd5c..d520f6b 100644 --- a/Lib/typing.py +++ b/Lib/typing.py @@ -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) diff --git a/Misc/NEWS.d/next/Library/2022-01-06-21-31-14.bpo-46244.hjyfJj.rst b/Misc/NEWS.d/next/Library/2022-01-06-21-31-14.bpo-46244.hjyfJj.rst new file mode 100644 index 0000000..5ca536a --- /dev/null +++ b/Misc/NEWS.d/next/Library/2022-01-06-21-31-14.bpo-46244.hjyfJj.rst @@ -0,0 +1,2 @@ +Removed ``__slots__`` from :class:`typing.ParamSpec` and :class:`typing.TypeVar`. +They served no purpose. Patch by Arie Bovenberg. |