Skip to content

Commit 081a214

Browse files
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
1 parent 6223cbf commit 081a214

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

Lib/typing.py

-6
Original file line numberDiff line numberDiff line change
@@ -805,9 +805,6 @@ def longest(x: A, y: A) -> A:
805805
Note that only type variables defined in global scope can be pickled.
806806
"""
807807

808-
__slots__ = ('__name__', '__bound__', '__constraints__',
809-
'__covariant__', '__contravariant__', '__dict__')
810-
811808
def __init__(self, name, *constraints, bound=None,
812809
covariant=False, contravariant=False):
813810
self.__name__ = name
@@ -907,9 +904,6 @@ def add_two(x: float, y: float) -> float:
907904
be pickled.
908905
"""
909906

910-
__slots__ = ('__name__', '__bound__', '__covariant__', '__contravariant__',
911-
'__dict__')
912-
913907
@property
914908
def args(self):
915909
return ParamSpecArgs(self)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
Removed ``__slots__`` from :class:`typing.ParamSpec` and :class:`typing.TypeVar`.
2+
They served no purpose. Patch by Arie Bovenberg.

0 commit comments

Comments
 (0)