from typing import TypeVar, Generic
T1 = TypeVar("T1", default=int)
T2 = TypeVar("T2")
# TypeError: Type parameter ~T2 without a default follows type parameter with a default
class Foo1(Generic[T1, T2]): ...
# SyntaxError: non-default type parameter 'T4' follows default type parameter
class Foo2[T3 = int, T4]: ...
ty should just focus on the TypeError while the SyntaxError would need to be raised by the parser (astral-sh/ruff#17412 (comment))