Skip to content

Commit

Permalink
bpo-46244: Remove __slots__ from typing.TypeVar, .ParamSpec (#30444)
Browse files Browse the repository at this point in the history
* add missing __slots__ to typing._TypeVarLike

* add news entry

* remove slots from _TypeVarLike base classes

* cleanup diff

* fix broken link in blurb
  • Loading branch information
ariebovenberg authored Jan 10, 2022
1 parent 6223cbf commit 081a214
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 6 deletions.
6 changes: 0 additions & 6 deletions Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,9 +805,6 @@ def longest(x: A, y: A) -> A:
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
Expand Down Expand Up @@ -907,9 +904,6 @@ def add_two(x: float, y: float) -> float:
be pickled.
"""

__slots__ = ('__name__', '__bound__', '__covariant__', '__contravariant__',
'__dict__')

@property
def args(self):
return ParamSpecArgs(self)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Removed ``__slots__`` from :class:`typing.ParamSpec` and :class:`typing.TypeVar`.
They served no purpose. Patch by Arie Bovenberg.

0 comments on commit 081a214

Please sign in to comment.