summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJelle Zijlstra <jelle.zijlstra@gmail.com>2023-05-11 23:41:26 (GMT)
committerGitHub <noreply@github.com>2023-05-11 23:41:26 (GMT)
commit37a5d256b97bc9d2a0ff445997fec851e328ebad (patch)
treeea62f93145bf4e5b99aeef0b7638923c8e14fdce
parent434db68ee31514ddc4aa93f8dfc2eb874d3669c5 (diff)
downloadcpython-37a5d256b97bc9d2a0ff445997fec851e328ebad.zip
cpython-37a5d256b97bc9d2a0ff445997fec851e328ebad.tar.gz
cpython-37a5d256b97bc9d2a0ff445997fec851e328ebad.tar.bz2
gh-104392: Remove _paramspec_tvars from typing (#104393)
This does nothing.
-rw-r--r--Lib/typing.py19
-rw-r--r--Misc/NEWS.d/next/Library/2023-05-11-07-50-00.gh-issue-104392.YSllzt.rst2
2 files changed, 8 insertions, 13 deletions
diff --git a/Lib/typing.py b/Lib/typing.py
index 4f8cba8..62c7dd3 100644
--- a/Lib/typing.py
+++ b/Lib/typing.py
@@ -775,8 +775,7 @@ def Concatenate(self, parameters):
"ParamSpec variable or ellipsis.")
msg = "Concatenate[arg, ...]: each arg must be a type."
parameters = (*(_type_check(p, msg) for p in parameters[:-1]), parameters[-1])
- return _ConcatenateGenericAlias(self, parameters,
- _paramspec_tvars=True)
+ return _ConcatenateGenericAlias(self, parameters)
@_SpecialForm
@@ -1307,8 +1306,7 @@ class _BaseGenericAlias(_Final, _root=True):
raise AttributeError(attr)
def __setattr__(self, attr, val):
- if _is_dunder(attr) or attr in {'_name', '_inst', '_nparams',
- '_paramspec_tvars'}:
+ if _is_dunder(attr) or attr in {'_name', '_inst', '_nparams'}:
super().__setattr__(attr, val)
else:
setattr(self.__origin__, attr, val)
@@ -1362,15 +1360,13 @@ class _GenericAlias(_BaseGenericAlias, _root=True):
# ClassVar[float]
# TypeVar[bool]
- def __init__(self, origin, args, *, inst=True, name=None,
- _paramspec_tvars=False):
+ def __init__(self, origin, args, *, inst=True, name=None):
super().__init__(origin, inst=inst, name=name)
if not isinstance(args, tuple):
args = (args,)
self.__args__ = tuple(... if a is _TypingEllipsis else
a for a in args)
self.__parameters__ = _collect_parameters(args)
- self._paramspec_tvars = _paramspec_tvars
if not name:
self.__module__ = origin.__module__
@@ -1513,8 +1509,7 @@ class _GenericAlias(_BaseGenericAlias, _root=True):
return new_args
def copy_with(self, args):
- return self.__class__(self.__origin__, args, name=self._name, inst=self._inst,
- _paramspec_tvars=self._paramspec_tvars)
+ return self.__class__(self.__origin__, args, name=self._name, inst=self._inst)
def __repr__(self):
if self._name:
@@ -1624,8 +1619,7 @@ class _CallableGenericAlias(_NotIterable, _GenericAlias, _root=True):
class _CallableType(_SpecialGenericAlias, _root=True):
def copy_with(self, params):
return _CallableGenericAlias(self.__origin__, params,
- name=self._name, inst=self._inst,
- _paramspec_tvars=True)
+ name=self._name, inst=self._inst)
def __getitem__(self, params):
if not isinstance(params, tuple) or len(params) != 2:
@@ -1869,8 +1863,7 @@ class Generic:
new_args.append(new_arg)
params = tuple(new_args)
- return _GenericAlias(cls, params,
- _paramspec_tvars=True)
+ return _GenericAlias(cls, params)
def __init_subclass__(cls, *args, **kwargs):
super().__init_subclass__(*args, **kwargs)
diff --git a/Misc/NEWS.d/next/Library/2023-05-11-07-50-00.gh-issue-104392.YSllzt.rst b/Misc/NEWS.d/next/Library/2023-05-11-07-50-00.gh-issue-104392.YSllzt.rst
new file mode 100644
index 0000000..b441b2a
--- /dev/null
+++ b/Misc/NEWS.d/next/Library/2023-05-11-07-50-00.gh-issue-104392.YSllzt.rst
@@ -0,0 +1,2 @@
+Remove undocumented and unused ``_paramspec_tvars`` attribute from some
+classes in :mod:`typing`.