Message 414970 - Python tracker (original) (raw)

This still behaves similarly after the bpo-46642 fix:

class V(TypeVar("T")): pass ... Traceback (most recent call last): File "", line 1, in File "/Users/jelle/py/cpython/Lib/typing.py", line 906, in init self.constraints = tuple(_type_check(t, msg) for t in constraints) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/jelle/py/cpython/Lib/typing.py", line 906, in self.constraints = tuple(_type_check(t, msg) for t in constraints) ^^^^^^^^^^^^^^^^^^^ File "/Users/jelle/py/cpython/Lib/typing.py", line 189, in _type_check raise TypeError(f"{msg} Got {arg!r:.100}.") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ TypeError: TypeVar(name, constraint, ...): constraints must be types. Got (~T,).