bzoracler · GitHub

Bug report

Bug description:

In accordance to the typing specifications, default= of ParamSpec can take an ellipsis .... However, this is not handled properly with old-style generics in the following example and causes a runtime error:

from typing import Generic, ParamSpec, TypeVar
P_default = ParamSpec("P_default", default=...)
T = TypeVar("T")
T_default = TypeVar("T_default", default=object)
class A(Generic[T, P_default, T_default]): pass
>>> A[int]
Traceback (most recent call last):
  ...
TypeError: can only concatenate list (not "tuple") to list

CPython versions tested on:

3.13

Operating systems tested on:

Linux

Linked PRs

Read the original on github.com ↗