Jelle Zijlstra <[email protected]> added the comment:
This still behaves similarly after the bpo-46642 fix:
>>> class V(TypeVar("T")): pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
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 <genexpr>
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,).
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46642>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com