@@ -332,8 +332,8 @@ def inner(*args, **kwds):
332
332
def _eval_type (t , globalns , localns , recursive_guard = frozenset ()):
333
333
"""Evaluate all forward references in the given type t.
334
334
For use of globalns and localns see the docstring for get_type_hints().
335
- recursive_guard is used to prevent prevent infinite recursion
336
- with recursive ForwardRef.
335
+ recursive_guard is used to prevent infinite recursion with a recursive
336
+ ForwardRef.
337
337
"""
338
338
if isinstance (t , ForwardRef ):
339
339
return t ._evaluate (globalns , localns , recursive_guard )
@@ -670,7 +670,9 @@ def Concatenate(self, parameters):
670
670
"ParamSpec variable." )
671
671
msg = "Concatenate[arg, ...]: each arg must be a type."
672
672
parameters = (* (_type_check (p , msg ) for p in parameters [:- 1 ]), parameters [- 1 ])
673
- return _ConcatenateGenericAlias (self , parameters )
673
+ return _ConcatenateGenericAlias (self , parameters ,
674
+ _typevar_types = (TypeVar , ParamSpec ),
675
+ _paramspec_tvars = True )
674
676
675
677
676
678
@_SpecialForm
@@ -1097,7 +1099,7 @@ def __getattr__(self, attr):
1097
1099
return self ._name or self .__origin__ .__name__
1098
1100
1099
1101
# We are careful for copy and pickle.
1100
- # Also for simplicity we just don't relay all dunder names
1102
+ # Also for simplicity we don't relay any dunder names
1101
1103
if '__origin__' in self .__dict__ and not _is_dunder (attr ):
1102
1104
return getattr (self .__origin__ , attr )
1103
1105
raise AttributeError (attr )
@@ -1339,8 +1341,6 @@ def _determine_new_args(self, args):
1339
1341
return tuple (new_args )
1340
1342
1341
1343
def copy_with (self , args ):
1342
- if isinstance (self , _ConcatenateGenericAlias ):
1343
- return self .__class__ (self .__origin__ , args )
1344
1344
return self .__class__ (self .__origin__ , args , name = self ._name , inst = self ._inst ,
1345
1345
_typevar_types = self ._typevar_types ,
1346
1346
_paramspec_tvars = self ._paramspec_tvars )
@@ -1552,11 +1552,6 @@ def __hash__(self):
1552
1552
1553
1553
1554
1554
class _ConcatenateGenericAlias (_GenericAlias , _root = True ):
1555
- def __init__ (self , * args , ** kwargs ):
1556
- super ().__init__ (* args , ** kwargs ,
1557
- _typevar_types = (TypeVar , ParamSpec ),
1558
- _paramspec_tvars = True )
1559
-
1560
1555
def copy_with (self , params ):
1561
1556
if isinstance (params [- 1 ], (list , tuple )):
1562
1557
return (* params [:- 1 ], * params [- 1 ])
0 commit comments