Skip to content

INTERNAL ERROR on: errors.py, line 268, in _add_error_info, assert file not in self.flushed_files #6379

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

Closed
koterpillar opened this issue Feb 12, 2019 · 1 comment

Comments

@koterpillar
Copy link

If MYPYPATH is set to the directory I'm checking, once mypy finds an error it crashes with INTERNAL ERROR.

Here are the files to reproduce:

scripts/__init__.py: empty file
scripts/a.py:

"asdf" + 10

scripts/b.py:

import a

Command line:

MYPYPATH=scripts mypy scripts
  • What is the actual behavior/output?

    scripts/a.py:1: error: Unsupported operand types for + ("str" and "int")
    scripts/a.py:1: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.670
    scripts/a.py:1: : note: please use --show-traceback to print a traceback when reporting a bug
    
  • What is the behavior/output you expect?

    The error (unsupported operand types) should be reported, but mypy shouldn't crash afterwards.

  • What are the versions of mypy and Python you are using?

    Python 3.7.2
    mypy 0.670

  • Do you see the same issue after installing mypy from Git master?

    Yes (version 0.680+dev.ce78d65d68cdd6899e7bc5c25e9f583d76520c50)

  • If mypy crashed with a traceback, please paste
    the full traceback below.

Traceback (most recent call last):
  File "/xxxx/.virtualenvs/xxxx/bin/mypy", line 10, in <module>
    sys.exit(console_entry())
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/__main__.py", line 7, in console_entry
    main(None)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/main.py", line 91, in main
    res = build.build(sources, options, None, flush_errors, fscache)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/build.py", line 162, in build
    result = _build(sources, options, alt_lib_path, flush_errors, fscache)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/build.py", line 217, in _build
    graph = dispatch(sources, manager)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/build.py", line 2360, in dispatch
    process_graph(graph, manager)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/build.py", line 2660, in process_graph
    process_stale_scc(graph, scc, manager)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/build.py", line 2767, in process_stale_scc
    graph[id].type_check_first_pass()
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/build.py", line 1919, in type_check_first_pass
    self.type_checker().check_first_pass()
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/checker.py", line 282, in check_first_pass
    self.accept(d)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/checker.py", line 393, in accept
    stmt.accept(self)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/nodes.py", line 926, in accept
    return visitor.visit_expression_stmt(self)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/checker.py", line 2635, in visit_expression_stmt
    self.expr_checker.accept(s.expr, allow_none_return=True, always_allow_any=True)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/checkexpr.py", line 3188, in accept
    typ = node.accept(self)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/nodes.py", line 1627, in accept
    return visitor.visit_op_expr(self)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/checkexpr.py", line 1884, in visit_op_expr
    allow_reverse=True)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/checkexpr.py", line 2270, in check_op
    self.msg.add_errors(msg)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/messages.py", line 99, in add_errors
    self.errors.add_error_info(info)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/errors.py", line 286, in add_error_info
    self._add_error_info(file, info)
  File "/xxxx/.virtualenvs/xxxx/lib/python3.7/site-packages/mypy/errors.py", line 268, in _add_error_info
    assert file not in self.flushed_files
AssertionError:
@msullivan
Copy link
Collaborator

The fact that we crash instead of producing an error message is a bug here, but the issue is that the file a.py is being picked twice with different module names, since it appears both on the command line and in mypy_path.

(Dupe of #4881)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants