Concatenate implementation generates runtime exception if parameterized by ... (original) (raw)

The following code should work without a runtime exception.

from typing import Any, Callable from typing_extensions import ParamSpec, Concatenate

P = ParamSpec("P") MyAlias = Callable[Concatenate[int, P], Any]

x: MyAlias[...]

It runs fine on Python 3.10 if using typing.Concatenate but fails on Python 3.9 if using typing_extensions.Concatenate. The runtime exception is:

TypeError: Parameters to generic types must be types. Got Ellipsis.