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

Crash in latest master with new semantics analyzer #6973

Closed
reinhrst opened this issue Jun 11, 2019 · 1 comment · Fixed by #6972
Closed

Crash in latest master with new semantics analyzer #6973

reinhrst opened this issue Jun 11, 2019 · 1 comment · Fixed by #6972
Labels
crash priority-1-normal semantic-analyzer Problems that happen during semantic analysis topic-plugins The plugin API and ideas for new plugins

Comments

@reinhrst
Copy link

As requested on #6960, I'm sharing the trace from the crash of the new semantics analyzer.

It crashes in directory with just 1 file (test.py):

import dataclasses


@dataclasses.dataclass(frozen=True)
class Test():
    def __init__(self, **kwargs) -> None:
        super().__init__(**kwargs)
> mypy . --new-semantic-analyzer --show-traceback
./test.py: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.710+dev.16ade15bcd2a5b6b02ad2c76b6b13efa6c2ddf0a
Traceback (most recent call last):
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/bin/mypy", line 10, in <module>
    sys.exit(console_entry())
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/__main__.py", line 8, in console_entry
    main(None, sys.stdout, sys.stderr)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/main.py", line 88, in main
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/build.py", line 168, in build
    result = _build(sources, options, alt_lib_path, flush_errors, fscache, stdout, stderr)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/build.py", line 228, in _build
    graph = dispatch(sources, manager, stdout)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/build.py", line 2574, in dispatch
    process_graph(graph, manager)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/build.py", line 2887, in process_graph
    process_stale_scc(graph, scc, manager)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/build.py", line 2985, in process_stale_scc
    semantic_analysis_for_scc(graph, scc, manager.errors)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/newsemanal/semanal_main.py", line 80, in semantic_analysis_for_scc
    check_type_arguments(graph, scc, errors)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/newsemanal/semanal_main.py", line 338, in check_type_arguments
    state.tree.accept(analyzer)
  File "/usr/local/Cellar/python/3.7.3/Frameworks/Python.framework/Versions/3.7/lib/python3.7/contextlib.py", line 130, in __exit__
    self.gen.throw(type, value, traceback)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/build.py", line 1832, in wrap_context
    yield
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/newsemanal/semanal_main.py", line 338, in check_type_arguments
    state.tree.accept(analyzer)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/nodes.py", line 281, in accept
    return visitor.visit_mypy_file(self)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/newsemanal/semanal_typeargs.py", line 33, in visit_mypy_file
    super().visit_mypy_file(o)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/traverser.py", line 33, in visit_mypy_file
    d.accept(self)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/nodes.py", line 913, in accept
    return visitor.visit_class_def(self)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/newsemanal/semanal_typeargs.py", line 44, in visit_class_def
    super().visit_class_def(defn)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/mixedtraverser.py", line 28, in visit_class_def
    super().visit_class_def(o)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/traverser.py", line 65, in visit_class_def
    o.defs.accept(self)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/nodes.py", line 978, in accept
    return visitor.visit_block(self)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/newsemanal/semanal_typeargs.py", line 48, in visit_block
    super().visit_block(o)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/traverser.py", line 37, in visit_block
    s.accept(self)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/nodes.py", line 655, in accept
    return visitor.visit_func_def(self)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/traverser.py", line 52, in visit_func_def
    self.visit_func(o)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/newsemanal/semanal_typeargs.py", line 40, in visit_func
    super().visit_func(defn)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/mixedtraverser.py", line 23, in visit_func
    self.visit_optional_type(o.type)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/mixedtraverser.py", line 91, in visit_optional_type
    t.accept(self)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/types.py", line 975, in accept
    return visitor.visit_callable_type(self)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/typetraverser.py", line 52, in visit_callable_type
    t.fallback.accept(self)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/types.py", line 666, in accept
    return visitor.visit_instance(self)
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/newsemanal/semanal_typeargs.py", line 54, in visit_instance
    for (i, arg), tvar in zip(enumerate(t.args), info.defn.type_vars):
  File "/Users/reinoud/Envs/tmp-4caf160a3041c9e/lib/python3.7/site-packages/mypy/nodes.py", line 2600, in __getattribute__
    raise AssertionError(object.__getattribute__(self, 'msg'))
AssertionError: fallback can't be filled out until semanal
./test.py: : note: use --pdb to drop into pdb
@ilevkivskyi ilevkivskyi added crash semantic-analyzer Problems that happen during semantic analysis priority-1-normal topic-plugins The plugin API and ideas for new plugins labels Jun 11, 2019
@ilevkivskyi
Copy link
Member

Oh, this will be fixed by #6972.

JukkaL pushed a commit that referenced this issue Jun 12, 2019
…es (#6972)

Fixes #6454.
Fixes #6973.

Note that the solution doesn't guarantee the order of numbers N in 
foo-redefinitionN coincides with the textual order of nodes. But it looks 
like we don't need this for anything.
PattenR pushed a commit to PattenR/mypy that referenced this issue Jun 23, 2019
…es (python#6972)

Fixes python#6454.
Fixes python#6973.

Note that the solution doesn't guarantee the order of numbers N in 
foo-redefinitionN coincides with the textual order of nodes. But it looks 
like we don't need this for anything.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
crash priority-1-normal semantic-analyzer Problems that happen during semantic analysis topic-plugins The plugin API and ideas for new plugins
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants