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
I'm sorry that I can't provide too much more context at this point, but I'm reporting the following INTERNAL ERROR as mypy (version requested:
$ MYPYPATH=<redacted local library path> mypy --strict-optional -p <redacted> --show-traceback --pdb
<file#1>:42: error: Class has two incompatible bases derived from tuple
<file#1>:42: error: List or tuple literal expected as the second argument to namedtuple()
<path to file#1>:123: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues
Dropping into pdb
> <working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py(308)join_instances()
-> args.append(join_types(t.args[i], s.args[i]))
(Pdb) p t.args
[Any, Any, Any]
(Pdb) p s.args
[]
(Pdb) p i
0
The virtualenv I was operating out of has the following mypy related packages at these versions:
Please paste the full traceback and exception. But likely your setting
MYPYPATH is at fault.
--Guido (mobile)
On Feb 8, 2017 4:59 PM, "joell" <notifications@github.com> wrote:
I'm sorry that I can't provide too much more context at this point, but I'm
reporting the following INTERNAL ERROR as mypy requested:
$ MYPYPATH=<redacted local library path> mypy --strict-optional -p
<redacted> --show-traceback --pdb
<file#1>:42: error: Class has two incompatible bases derived from tuple
<file#1>:42: error: List or tuple literal expected as the second
argument to namedtuple()
<path to file#1>:123: error: INTERNAL ERROR -- please report a bug at
https://github.com/python/mypy/issues
Dropping into pdb
Here's the traceback and exception. If it helps both s and t are Tuple types. The source line it's triggering on is vaguely of the form
result = var1 if isinstance(var1, type1) else var2
where type1 and the types of var1 and var2 are all classes which inherit from namedtuple.
(Once again, I apologize that I can't share the actual code. Though I work on it I don't own it, and am not at liberty to share it sadly. I'm just reporting the bug in case you find it helpful; I'm not expecting a solution.)
Regarding MYPYPATH, I've been using that environment assignment for a few months now with this codebase without any issues, so if it is at fault it hasn't triggered until now.
Traceback (most recent call last):
File "<working directory...>/mypy-env/bin/mypy", line 6, in <module>
main(__file__)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/main.py", line 42, in main
res = type_check_only(sources, bin_dir, options)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/main.py", line 87, in type_check_only
options=options)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/build.py", line 183, in build
dispatch(sources, manager)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/build.py", line 1526, in dispatch
process_graph(graph, manager)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/build.py", line 1762, in process_graph
process_stale_scc(graph, scc)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/build.py", line 1841, in process_stale_scc
graph[id].type_check_first_pass()
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/build.py", line 1451, in type_check_first_pass
self.type_checker.check_first_pass()
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 175, in check_first_pass
self.accept(d)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
typ = node.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 713, in accept
return visitor.visit_class_def(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 996, in visit_class_def
self.accept(defn.defs)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
typ = node.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 774, in accept
return visitor.visit_block(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 1091, in visit_block
self.accept(s)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
typ = node.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 597, in accept
return visitor.visit_decorator(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 1956, in visit_decorator
e.func.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 532, in accept
return visitor.visit_func_def(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 459, in visit_func_def
self.check_func_item(defn, name=defn.name())
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 522, in check_func_item
self.check_func_def(defn, typ, name)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 652, in check_func_def
self.accept(item.body)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
typ = node.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 774, in accept
return visitor.visit_block(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 1091, in visit_block
self.accept(s)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
typ = node.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 815, in accept
return visitor.visit_assignment_stmt(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 1099, in visit_assignment_stmt
self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 1170, in check_assignment
self.infer_variable_type(inferred, lvalue, self.accept(rvalue),
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
typ = node.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 1639, in accept
return visitor.visit_conditional_expr(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 2235, in visit_conditional_expr
return self.expr_checker.visit_conditional_expr(e)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checkexpr.py", line 1958, in visit_conditional_expr
res = join.join_types(if_type, else_type)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 90, in join_types
return t.accept(TypeJoinVisitor(s))
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/types.py", line 874, in accept
return visitor.visit_tuple_type(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 240, in visit_tuple_type
fallback = join_instances(self.s.fallback, t.fallback)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 319, in join_instances
return join_instances_via_supertype(s, t)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 335, in join_instances_via_supertype
res = join_instances(mapped, s)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 319, in join_instances
return join_instances_via_supertype(s, t)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 335, in join_instances_via_supertype
res = join_instances(mapped, s)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 319, in join_instances
return join_instances_via_supertype(s, t)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 335, in join_instances_via_supertype
res = join_instances(mapped, s)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 319, in join_instances
return join_instances_via_supertype(s, t)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 335, in join_instances_via_supertype
res = join_instances(mapped, s)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 308, in join_instances
args.append(join_types(t.args[i], s.args[i]))
IndexError: list index out of range
On Feb 8, 2017 6:07 PM, "joell" ***@***.***> wrote:
Here's the traceback and exception. If it helps both s and t are Tuple
types. The source line it's triggering on is vaguely of the form
result = var1 if isinstance(var1, type1) else var2
where type1 and the types of var1 and var2 are all classes which inherit
from namedtuple.
(Once again, I apologize that I can't share the actual code. Though I work
on it I don't own it, and am not at liberty to share it sadly. I'm just
reporting the bug in case you find it helpful; I'm not expecting a
solution.)
Regarding MYPYPATH, I've been using that environment assignment for a few
months now with this codebase without any issues, so if it is at fault it
hasn't triggered until now.
Traceback (most recent call last):
File "<working directory...>/mypy-env/bin/mypy", line 6, in <module>
main(__file__)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/main.py", line 42, in main
res = type_check_only(sources, bin_dir, options)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/main.py", line 87, in type_check_only
options=options)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/build.py", line 183, in build
dispatch(sources, manager)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/build.py", line 1526, in dispatch
process_graph(graph, manager)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/build.py", line 1762, in process_graph
process_stale_scc(graph, scc)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/build.py", line 1841, in process_stale_scc
graph[id].type_check_first_pass()
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/build.py", line 1451, in type_check_first_pass
self.type_checker.check_first_pass()
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 175, in check_first_pass
self.accept(d)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
typ = node.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 713, in accept
return visitor.visit_class_def(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 996, in visit_class_def
self.accept(defn.defs)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
typ = node.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 774, in accept
return visitor.visit_block(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 1091, in visit_block
self.accept(s)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
typ = node.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 597, in accept
return visitor.visit_decorator(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 1956, in visit_decorator
e.func.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 532, in accept
return visitor.visit_func_def(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 459, in visit_func_def
self.check_func_item(defn, name=defn.name())
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 522, in check_func_item
self.check_func_def(defn, typ, name)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 652, in check_func_def
self.accept(item.body)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
typ = node.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 774, in accept
return visitor.visit_block(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 1091, in visit_block
self.accept(s)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
typ = node.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 815, in accept
return visitor.visit_assignment_stmt(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 1099, in visit_assignment_stmt
self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 1170, in check_assignment
self.infer_variable_type(inferred, lvalue, self.accept(rvalue),
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 247, in accept
typ = node.accept(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/nodes.py", line 1639, in accept
return visitor.visit_conditional_expr(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checker.py", line 2235, in visit_conditional_expr
return self.expr_checker.visit_conditional_expr(e)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/checkexpr.py", line 1958, in visit_conditional_expr
res = join.join_types(if_type, else_type)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 90, in join_types
return t.accept(TypeJoinVisitor(s))
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/types.py", line 874, in accept
return visitor.visit_tuple_type(self)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 240, in visit_tuple_type
fallback = join_instances(self.s.fallback, t.fallback)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 319, in join_instances
return join_instances_via_supertype(s, t)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 335, in join_instances_via_supertype
res = join_instances(mapped, s)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 319, in join_instances
return join_instances_via_supertype(s, t)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 335, in join_instances_via_supertype
res = join_instances(mapped, s)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 319, in join_instances
return join_instances_via_supertype(s, t)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 335, in join_instances_via_supertype
res = join_instances(mapped, s)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 319, in join_instances
return join_instances_via_supertype(s, t)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 335, in join_instances_via_supertype
res = join_instances(mapped, s)
File "<working directory...>/mypy-env/lib/python3.6/site-packages/mypy/join.py", line 308, in join_instances
args.append(join_types(t.args[i], s.args[i]))
IndexError: list index out of range
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2835 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/ACwrMkOIGGzXVaPrKXXcYgnyRRpYFA1eks5ranT2gaJpZM4L7kkd>
.
The same failure occurs with mypy-lang 0.4.6, mypy 0.470, and with mypy's master branch at commit ae47a3e (which is versioned as 0.480.dev0 when I install it).
I'm sorry to have to ask you to do more investigation. Since you can't
share the code with me, I can't repro the issue, and it's hard to
understand where the faulty values might come from. If you have time (but
onlyif you have time!) could you spend some time trying to repro this in a
small but complete program that you can share here? That would be very
helpful.
You have no need to apologize at all! I realized diagnosing the error with so little information would probably be a long shot, but since the error requested that I submit an issue I figured I'd at least pass along what I had.
It's not immediately clear to me how this error is triggering, as the typing of the surrounding code gets pretty complex. If I'm able to squeeze in the time to dig through it enough to repro with a small code sample I could share, I'll pass it along, but I can't promise I'll be able to.
Thanks for your help, and since I have you here in the moment, thank you also for all the great work you've done in creating and advancing Python!
I think this should be also fixed by #3952, several scenarios with this traceback were caused by various types not being analysed in the third pass. However, the code is private, so I can't check, @joell please reopen if this crash still happens on master.
Activity
gvanrossum commentedon Feb 9, 2017
joell commentedon Feb 9, 2017
Here's the traceback and exception. If it helps both
sandtareTupletypes. The source line it's triggering on is vaguely of the formwhere
type1and the types ofvar1andvar2are all classes which inherit fromnamedtuple.(Once again, I apologize that I can't share the actual code. Though I work on it I don't own it, and am not at liberty to share it sadly. I'm just reporting the bug in case you find it helpful; I'm not expecting a solution.)
Regarding
MYPYPATH, I've been using that environment assignment for a few months now with this codebase without any issues, so if it is at fault it hasn't triggered until now.gvanrossum commentedon Feb 9, 2017
joell commentedon Feb 9, 2017
The same failure occurs with mypy-lang 0.4.6, mypy 0.470, and with mypy's master branch at commit ae47a3e (which is versioned as 0.480.dev0 when I install it).
gvanrossum commentedon Feb 9, 2017
joell commentedon Feb 9, 2017
You have no need to apologize at all! I realized diagnosing the error with so little information would probably be a long shot, but since the error requested that I submit an issue I figured I'd at least pass along what I had.
It's not immediately clear to me how this error is triggering, as the typing of the surrounding code gets pretty complex. If I'm able to squeeze in the time to dig through it enough to repro with a small code sample I could share, I'll pass it along, but I can't promise I'll be able to.
Thanks for your help, and since I have you here in the moment, thank you also for all the great work you've done in creating and advancing Python!
ilevkivskyi commentedon Sep 29, 2017
I think this should be also fixed by #3952, several scenarios with this traceback were caused by various types not being analysed in the third pass. However, the code is private, so I can't check, @joell please reopen if this crash still happens on master.