Skip to content

Commit b3aa598

Browse files
committed
Generator not necessary anymore
1 parent 251d312 commit b3aa598

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

src/typing_extensions.py

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3647,23 +3647,20 @@ def __repr__(self) -> str:
36473647
def _check_single_param(self, param, recursion=0):
36483648
# Allow [], [int], [int, str], [int, ...], [int, T]
36493649
if param is ...:
3650-
yield ...
3650+
return ...
36513651
# Note in <= 3.9 _ConcatenateGenericAlias inherits from list
3652-
elif isinstance(param, list) and recursion == 0:
3653-
yield [checked
3654-
for arg in param
3655-
for checked in self._check_single_param(arg, recursion+1)]
3656-
else:
3657-
yield typing._type_check(
3652+
if isinstance(param, list) and recursion == 0:
3653+
return [self._check_single_param(arg, recursion+1)
3654+
for arg in param]
3655+
return typing._type_check(
36583656
param, f'Subscripting {self.__name__} requires a type.'
36593657
)
36603658

36613659
def _check_parameters(self, parameters):
36623660
if sys.version_info < (3, 11):
36633661
return tuple(
3664-
checked
3662+
self._check_single_param(item)
36653663
for item in parameters
3666-
for checked in self._check_single_param(item)
36673664
)
36683665
return tuple(typing._type_check(
36693666
item, f'Subscripting {self.__name__} requires a type.'

0 commit comments

Comments
 (0)