Skip to content

Commit

Permalink
Consider Type Error from python/cpython/pull/124795
Browse files Browse the repository at this point in the history
  • Loading branch information
Daraan committed Sep 30, 2024
1 parent c00494a commit 4e2f041
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/typing_extensions.py
Original file line number Diff line number Diff line change
Expand Up @@ -3539,6 +3539,8 @@ def __init__(self, name: str, value, *, type_params=()):
default_value_encountered = False
parameters = []
for type_param in type_params:
if not isinstance(type_param, (TypeVar, TypeVarTuple, ParamSpec)):
raise TypeError(f"Expected a type param, got {type_param!r}")
has_default = getattr(type_param, '__default__', NoDefault) is not NoDefault
if default_value_encountered and not has_default:
raise TypeError(f'Type parameter {type_param!r} without a default'
Expand Down

0 comments on commit 4e2f041

Please sign in to comment.