Skip to content

Commit

Permalink
gh-104392: Remove _paramspec_tvars from typing (#104393)
Browse files Browse the repository at this point in the history
This does nothing.
  • Loading branch information
JelleZijlstra authored May 11, 2023
1 parent 434db68 commit 37a5d25
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
19 changes: 6 additions & 13 deletions Lib/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -1307,8 +1306,7 @@ def __getattr__(self, attr):
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)
Expand Down Expand Up @@ -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__

Expand Down Expand Up @@ -1513,8 +1509,7 @@ def _make_substitution(self, args, new_arg_by_param):
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:
Expand Down Expand Up @@ -1624,8 +1619,7 @@ def __reduce__(self):
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:
Expand Down Expand Up @@ -1869,8 +1863,7 @@ def __class_getitem__(cls, params):
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)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Remove undocumented and unused ``_paramspec_tvars`` attribute from some
classes in :mod:`typing`.

0 comments on commit 37a5d25

Please sign in to comment.