Skip to content

Do not leak UnboundTypes to type checking #4987

Closed
@ilevkivskyi

Description

@ilevkivskyi

Sometimes UnboundType leaks to type checking, this is not good because it can lead to crashes like this:

File ".../mypy/subtypes.py", line 814, in <listcomp>
if (not (is_proper_subtype(erase_type(item), erased_s) or
File ".../mypy/erasetype.py", line 25, in erase_type
return typ.accept(EraseTypeVisitor())
File ".../mypy/types.py", line 194, in accept
return visitor.visit_unbound_type(self)
File ".../mypy/erasetype.py", line 31, in visit_unbound_type
assert False, 'Not supported'
AssertionError: Not supported

It would be better to replace all UnboundTypes with Any (after an error is reported).

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions