You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We recently upgraded to a newer mypy version (c000062) and are seeing new crashes. One has a traceback ending in
[...]
File "/Users/damien/src/client/.mypy/venv/lib/python3.6/site-packages/mypy/checkexpr.py", line 753, in infer_function_type_arguments_using_context
args = infer_type_arguments(callable.type_var_ids(), ret_type, erased_ctx)
File "/Users/damien/src/client/.mypy/venv/lib/python3.6/site-packages/mypy/infer.py", line 43, in infer_type_arguments
return solve_constraints(type_var_ids, constraints)
File "/Users/damien/src/client/.mypy/venv/lib/python3.6/site-packages/mypy/solve.py", line 52, in solve_constraints
top = meet_types(top, c.target)
File "/Users/damien/src/client/.mypy/venv/lib/python3.6/site-packages/mypy/meet.py", line 25, in meet_types
return t.accept(TypeMeetVisitor(s))
File "/Users/damien/src/client/.mypy/venv/lib/python3.6/site-packages/mypy/types.py", line 1287, in accept
return visitor.visit_partial_type(self)
File "/Users/damien/src/client/.mypy/venv/lib/python3.6/site-packages/mypy/meet.py", line 288, in visit_partial_type
assert False, 'Internal error'
AssertionError: Internal error
And the other:
File "/Users/guido/src/server/.mypy/venv/lib/python3.6/site-packages/mypy/nodes.py", line 817, in accept
return visitor.visit_assignment_stmt(self)
File "/Users/guido/src/server/.mypy/venv/lib/python3.6/site-packages/mypy/checker.py", line 1307, in visit_assignment_stmt
self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
File "/Users/guido/src/server/.mypy/venv/lib/python3.6/site-packages/mypy/checker.py", line 1367, in check_assignment
self.infer_partial_type(lvalue_type.var, lvalue, rvalue_type)
File "/Users/guido/src/server/.mypy/venv/lib/python3.6/site-packages/mypy/checker.py", line 1833, in infer_partial_type
self.set_inferred_type(name, lvalue, partial_type)
File "/Users/guido/src/server/.mypy/venv/lib/python3.6/site-packages/mypy/checker.py", line 1848, in set_inferred_type
assert lvalue.def_var is not None
AssertionError:
I haven't investigated these nor tried to reduce them. I do have a repeatable demo of the latter.
Thanks for finding repros and adding fixes! Did something change recently that caused these crashes to appear, or were we just lucky we didn't have these patterns in our codebase before?
Did something change recently that caused these crashes to appear, or were we just lucky we didn't have these patterns in our codebase before?
The one with def_var is new, it was introduced in one of my recent strict optional PRs where I erroneously used assert ... is not None instead of if ... is not None:. Other crashes are old.
Activity
ilevkivskyi commentedon Sep 22, 2017
Does the first crash occurs only in quick mode? It would be quite strange.
gvanrossum commentedon Sep 22, 2017
Hm, you're right, the first crash also happened in plain --incremental mode.
ilevkivskyi commentedon Sep 23, 2017
It looks like I have also a repro for the second crash that doesn't even require
--incremental:ilevkivskyi commentedon Sep 24, 2017
@gvanrossum
I still can't reproduce the first crash. Do you have some more hints?
[-]New crashes in quick mode[/-][+]New incremental crashes related to partial types[/+]ilevkivskyi commentedon Sep 24, 2017
Bingo!
I have the repro for the first crash as well. It doesn't require
--incremental(I have found two similar scenarios with slightly different tracebacks but all related to partial types, I will add them to tests).
[-]New incremental crashes related to partial types[/-][+]New crashes related to partial types[/+]ilevkivskyi commentedon Sep 24, 2017
OK, I updated PR #3995 so that it fixes both these crashes and two related crash scenarios.
gvanrossum commentedon Sep 24, 2017
Thanks for finding repros and adding fixes! Did something change recently that caused these crashes to appear, or were we just lucky we didn't have these patterns in our codebase before?
ilevkivskyi commentedon Sep 24, 2017
The one with
def_varis new, it was introduced in one of my recent strict optional PRs where I erroneously usedassert ... is not Noneinstead ofif ... is not None:. Other crashes are old.Fix recently reported partial type crashes (#3995)