From 081a2140083680ffc309e53699aea29e71760d70 Mon Sep 17 00:00:00 2001 From: Arie Bovenberg Date: Tue, 11 Jan 2022 00:43:39 +0100 Subject: 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 --- Lib/typing.py | 6 ------ Misc/NEWS.d/next/Library/2022-01-06-21-31-14.bpo-46244.hjyfJj.rst | 2 ++ 2 files changed, 2 insertions(+), 6 deletions(-) create mode 100644 Misc/NEWS.d/next/Library/2022-01-06-21-31-14.bpo-46244.hjyfJj.rst 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. -- cgit v0.12