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

dmypy crashes when switching branches #16754

Open
Randl opened this issue Jan 6, 2024 · 1 comment
Open

dmypy crashes when switching branches #16754

Randl opened this issue Jan 6, 2024 · 1 comment

Comments

@Randl
Copy link

Randl commented Jan 6, 2024

Crash Report

I'm running mypy on qiskit. If I run the daemon and then switch branches, mypy crashes. The branches are Qiskit/qiskit@fbb0938 and Randl/qiskit-terra@7046f11
The command is

 dmypy run -- --ignore-missing-imports --no-strict-optional --allow-untyped-globals --allow-redefinition --show-error-codes  --check-untyped-defs --show-traceback  qiskit

Traceback

version: 1.9.0+dev.fbb738a4626976f83a7412df73533d87483a31b7
Daemon crashed!
Traceback (most recent call last):
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/dmypy_server.py", line 236, in serve
    resp = self.run_command(command, data)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/dmypy_server.py", line 285, in run_command
    ret = method(self, **data)
          ^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/dmypy_server.py", line 353, in cmd_run
    return self.check(sources, export_types, is_tty, terminal_width)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/dmypy_server.py", line 429, in check
    messages = self.fine_grained_increment_follow_imports(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/dmypy_server.py", line 631, in fine_grained_increment_follow_imports
    messages = fine_grained_manager.update(changed, [], followed=True)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/server/update.py", line 267, in update
    result = self.update_one(
             ^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/server/update.py", line 369, in update_one
    result = self.update_module(next_id, next_path, next_id in removed_set, followed)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/server/update.py", line 452, in update_module
    remaining += propagate_changes_using_dependencies(
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/server/update.py", line 881, in propagate_changes_using_dependencies
    triggered |= reprocess_nodes(manager, graph, id, nodes, deps, processed_targets)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/server/update.py", line 1010, in reprocess_nodes
    semantic_analysis_for_targets(graph[module_id], nodes, graph, saved_attrs)
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/semanal_main.py", line 137, in semantic_analysis_for_targets
    process_top_levels(graph, [state.id], patches)
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/semanal_main.py", line 220, in process_top_levels
    deferred, incomplete, progress = semantic_analyze_target(
                                     ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/semanal_main.py", line 349, in semantic_analyze_target
    analyzer.refresh_partial(
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/semanal.py", line 597, in refresh_partial
    self.refresh_top_level(node)
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/semanal.py", line 608, in refresh_top_level
    self.accept(d)
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/semanal.py", line 6544, in accept
    report_internal_error(err, self.errors.file, node.line, self.errors, self.options)
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/errors.py", line 1261, in report_internal_error
    raise err
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/semanal.py", line 6542, in accept
    node.accept(self)
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/nodes.py", line 1310, in accept
    return visitor.visit_assignment_stmt(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/semanal.py", line 2860, in visit_assignment_stmt
    if self.check_and_set_up_type_alias(s):
       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/semanal.py", line 3617, in check_and_set_up_type_alias
    res, alias_tvars, depends_on, qualified_tvars, empty_tuple_index = self.analyze_alias(
                                                                       ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/semanal.py", line 3506, in analyze_alias
    analyzed, depends_on = analyze_type_alias(
                           ^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/typeanal.py", line 156, in analyze_type_alias
    res = type.accept(analyzer)
          ^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/types.py", line 955, in accept
    return visitor.visit_unbound_type(self)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/typeanal.py", line 259, in visit_unbound_type
    typ = self.visit_unbound_type_nonoptional(t, defining_literal)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/typeanal.py", line 399, in visit_unbound_type_nonoptional
    special = self.try_analyze_special_unbound_type(t, fullname)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/typeanal.py", line 624, in try_analyze_special_unbound_type
    return self.analyze_literal_type(t)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/typeanal.py", line 1470, in analyze_literal_type
    analyzed_types = self.analyze_literal_param(i + 1, arg, t)
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/typeanal.py", line 1536, in analyze_literal_param
    fallback = self.named_type(arg.base_type_name)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/typeanal.py", line 1735, in named_type
    node = self.lookup_fully_qualified(fully_qualified_name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/typeanal.py", line 256, in lookup_fully_qualified
    return self.api.lookup_fully_qualified(name)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/lib/python3.11/site-packages/mypy/semanal.py", line 5855, in lookup_fully_qualified
    assert ret is not None, fullname
           ^^^^^^^^^^^^^^^
AssertionError: builtins.int

To Reproduce

Checkout one branch, run dmypy, checkout second branch, run dmypy.

Your Environment

  • Mypy version used: 1.9.0+dev.fbb738a4626976f83a7412df73533d87483a31b7 (current dev)
  • Python version used: 3.11
  • Operating system and version: macOS 14.1.1 (23B81)
@Randl Randl added the crash label Jan 6, 2024
@Randl
Copy link
Author

Randl commented Jan 6, 2024

Probably related to #16744 and #14645

@AlexWaygood AlexWaygood added the topic-daemon dmypy label Jan 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants