Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hang when type checking in weak global mode #858

Closed
JukkaL opened this issue Aug 21, 2015 · 0 comments
Closed

Hang when type checking in weak global mode #858

JukkaL opened this issue Aug 21, 2015 · 0 comments
Labels
bug mypy got something wrong

Comments

@JukkaL
Copy link
Collaborator

JukkaL commented Aug 21, 2015

This results in a hang, when type checked in --py2 mode (but only then):

# mypy: weak=global
ans = set()
ans = ans.union([])
for i in range(10):
    ans = ans.union([])

Traceback:

Traceback (most recent call last):
  File "/Users/jukka/src/mypy/scripts/mypy", line 184, in <module>
    main()
  File "/Users/jukka/src/mypy/scripts/mypy", line 36, in main
    type_check_only(path, module, bin_dir, options)
  File "/Users/jukka/src/mypy/scripts/mypy", line 80, in type_check_only
    python_path=options.python_path)
  File "/Users/jukka/src/mypy/mypy/build.py", line 160, in build
    result = manager.process(UnprocessedFile(info, program_text))
  File "/Users/jukka/src/mypy/mypy/build.py", line 344, in process
    next.process()
  File "/Users/jukka/src/mypy/mypy/build.py", line 796, in process
    self.type_checker().visit_file(self.tree, self.tree.path)
  File "/Users/jukka/src/mypy/mypy/checker.py", line 359, in visit_file
    self.accept(d)
  File "/Users/jukka/src/mypy/mypy/checker.py", line 366, in accept
    typ = node.accept(self)
  File "/Users/jukka/src/mypy/mypy/nodes.py", line 585, in accept
    return visitor.visit_for_stmt(self)
  File "/Users/jukka/src/mypy/mypy/checker.py", line 1602, in visit_for_stmt
    self.accept_in_frame(s.body, repeat_till_fixed=True)
  File "/Users/jukka/src/mypy/mypy/checker.py", line 380, in accept_in_frame
    changed, _ = self.binder.pop_frame(True, True)
  File "/Users/jukka/src/mypy/mypy/checker.py", line 189, in pop_frame
    changed = self.update_from_options(options)
  File "/Users/jukka/src/mypy/mypy/checker.py", line 144, in update_from_options
    type = join_simple(self.frames[0][key], type, other)
  File "/Users/jukka/src/mypy/mypy/join.py", line 26, in join_simple
    if is_subtype(s, t):
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 47, in is_subtype
    return left.accept(SubtypeVisitor(right, type_parameter_checker))
  File "/Users/jukka/src/mypy/mypy/types.py", line 178, in accept
    return visitor.visit_instance(self)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 108, in visit_instance
    zip(t.args, right.args, right.type.defn.type_vars))
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 107, in <genexpr>
    for lefta, righta, tvar in
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 20, in check_type_parameter
    return is_subtype(lefta, righta, check_type_parameter)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 47, in is_subtype
    return left.accept(SubtypeVisitor(right, type_parameter_checker))
  File "/Users/jukka/src/mypy/mypy/types.py", line 459, in accept
    return visitor.visit_union_type(self)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 180, in visit_union_type
    for item in left.items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 180, in <genexpr>
    for item in left.items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 47, in is_subtype
    return left.accept(SubtypeVisitor(right, type_parameter_checker))
  File "/Users/jukka/src/mypy/mypy/types.py", line 459, in accept
    return visitor.visit_union_type(self)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 180, in visit_union_type
    for item in left.items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 180, in <genexpr>
    for item in left.items)
...
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in is_subtype
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in <genexpr>
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in is_subtype
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in <genexpr>
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in is_subtype
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in <genexpr>
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in is_subtype
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in <genexpr>
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in is_subtype
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in <genexpr>
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in is_subtype
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in <genexpr>
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in is_subtype
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 45, in <genexpr>
    for item in cast(UnionType, right).items)
  File "/Users/jukka/src/mypy/mypy/subtypes.py", line 40, in is_subtype
    if (isinstance(right, AnyType) or isinstance(right, UnboundType)
  File "/Users/jukka/venv/mypy/bin/../lib/python3.4/abc.py", line 182, in __instancecheck__
    if subclass in cls._abc_cache:
  File "/Users/jukka/venv/mypy/bin/../lib/python3.4/_weakrefset.py", line 72, in __contains__
    wr = ref(item)
KeyboardInterrupt
@JukkaL JukkaL added bug mypy got something wrong hack labels Aug 21, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug mypy got something wrong
Projects
None yet
Development

No branches or pull requests

2 participants