[Python-checkins] bpo-46244: Remove __slots__ from typing.TypeVar, .ParamSpec (#30444)
Fidget-Spinner
webhook-mailer at python.org
Mon Jan 10 18:43:44 EST 2022
https://github.com/python/cpython/commit/081a2140083680ffc309e53699aea29e71760d70
commit: 081a2140083680ffc309e53699aea29e71760d70
branch: main
author: Arie Bovenberg <a.c.bovenberg at gmail.com>
committer: Fidget-Spinner <28750310+Fidget-Spinner at users.noreply.github.com>
date: 2022-01-11T07:43:39+08:00
summary:
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
files:
A Misc/NEWS.d/next/Library/2022-01-06-21-31-14.bpo-46244.hjyfJj.rst
M Lib/typing.py
diff --git a/Lib/typing.py b/Lib/typing.py
index ae1dd5c2d7689..d520f6b2e1b3d 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -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
@@ -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)
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 0000000000000..5ca536a97c9cd
--- /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.
More information about the Python-checkins
mailing list