[issue46642] typing: tested TypeVar instance subclass TypeError is incidental

Gregory Beauregard report at bugs.python.org
Sat Feb 5 13:45:04 EST 2022


Gregory Beauregard <greg at greg.red> added the comment:

The reason this test passed before is a bit confusing. Run the following code standalone to see where the type(TypeVar('T'))(name, bases, namespace) check is coming from.
```
class TypeVar:
    def __init__(self, name, *constraints):
        # in actual TypeVar, each constraint is run through
        # typing._type_check, casuing TypeError via not callable() 
        print(repr(constraints))

class V(TypeVar("T")):
    pass
```

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46642>
_______________________________________


More information about the Python-bugs-list mailing list