Skip to content

Do not leak UnboundTypes to type checking #4987

Closed

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).

Activity

  1. ilevkivskyi commented on Jun 21, 2018

    @ilevkivskyi
    MemberAuthor

    Update: this doesn't crash anymore, but we still to avoid leaking UnboundTypes.

  2. added a commit that references this issue on Nov 24, 2022
    13bd201
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions