Skip to content

Internal error: De-serialization failure: TypeInfo not fixed #18087

@inducer

Description

@inducer

Crash Report

The traceback below happens on warm-cache runs. The next run rm -Rf .mypy_cache finishes without issue. The problem occurs irrespective of whether orjson is used.

Traceback

pytato/target/python/__init__.py:39: note: class abc.abstractproperty is deprecated: Use 'property' with 'abstractmethod' instead  [deprecated]
pytato/scalar_expr.py:97: error: Incompatible return value type (got "int | integer[Any] | float | complex | inexact[Any] | bool | Expression | tuple[ExpressionT, ...]", expected "int | integer[Any] | float | complex | inexact[Any] | Expression")  [return-value]
pytato/scalar_expr.py:149: error: Argument 1 to "Reduce" has incompatible type "int | integer[Any] | float | complex | inexact[Any] | bool | Expression | tuple[ExpressionT, ...]"; expected "int | integer[Any] | float | complex | inexact[Any] | Expression"  [arg-type]
Traceback (most recent call last):
  File "<frozen runpy>", line 198, in _run_module_as_main
  File "<frozen runpy>", line 88, in _run_code
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/__main__.py", line 37, in <module>
    console_entry()
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/__main__.py", line 15, in console_entry
    main()
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/main.py", line 109, in main
    res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/main.py", line 193, in run_build
    res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/build.py", line 194, in build
    result = _build(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/build.py", line 269, in _build
    graph = dispatch(sources, manager, stdout)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/build.py", line 2936, in dispatch
    process_graph(graph, manager)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/build.py", line 3334, in process_graph
    process_stale_scc(graph, scc, manager)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/build.py", line 3435, in process_stale_scc
    graph[id].type_check_first_pass()
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/build.py", line 2305, in type_check_first_pass
    self.type_checker().check_first_pass()
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 483, in check_first_pass
    self.accept(d)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 592, in accept
    stmt.accept(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 1196, in accept
    return visitor.visit_class_def(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 2461, in visit_class_def
    self.accept(defn.defs)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 592, in accept
    stmt.accept(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 1277, in accept
    return visitor.visit_block(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 2951, in visit_block
    self.accept(s)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 592, in accept
    stmt.accept(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 827, in accept
    return visitor.visit_func_def(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 1046, in visit_func_def
    self._visit_func_def(defn)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 1050, in _visit_func_def
    self.check_func_item(defn, name=defn.name)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 1084, in check_func_item
    self.check_func_def(defn, typ, name, allow_empty)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 1360, in check_func_def
    self.accept(item.body)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 592, in accept
    stmt.accept(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 1277, in accept
    return visitor.visit_block(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 2951, in visit_block
    self.accept(s)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 592, in accept
    stmt.accept(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 1364, in accept
    return visitor.visit_assignment_stmt(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 3000, in visit_assignment_stmt
    self.check_assignment(s.lvalues[-1], s.rvalue, s.type is None, s.new_syntax)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checker.py", line 3217, in check_assignment
    rvalue_type = self.expr_checker.accept(rvalue, type_context=type_context)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 5885, in accept
    typ = node.accept(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 1984, in accept
    return visitor.visit_call_expr(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 483, in visit_call_expr
    return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 617, in visit_call_expr_inner
    ret_type = self.check_call_expr_with_callee_type(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1474, in check_call_expr_with_callee_type
    ret_type, callee_type = self.check_call(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1572, in check_call
    return self.check_callable_call(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1786, in check_callable_call
    arg_types = self.infer_arg_types_in_context(callee, args, arg_kinds, formal_to_actual)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1960, in infer_arg_types_in_context
    res[ai] = self.accept(args[ai], arg_type)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 5885, in accept
    typ = node.accept(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 2398, in accept
    return visitor.visit_generator_expr(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 5647, in visit_generator_expr
    return self.check_generator_or_comprehension(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 5683, in check_generator_or_comprehension
    return self.check_call(constructor, [gen.left_expr], [nodes.ARG_POS], gen)[0]
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1572, in check_call
    return self.check_callable_call(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1757, in check_callable_call
    callee = self.infer_function_type_arguments(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 2073, in infer_function_type_arguments
    arg_types = self.infer_arg_types_in_context(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1960, in infer_arg_types_in_context
    res[ai] = self.accept(args[ai], arg_type)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 5885, in accept
    typ = node.accept(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 1984, in accept
    return visitor.visit_call_expr(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 483, in visit_call_expr
    return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 617, in visit_call_expr_inner
    ret_type = self.check_call_expr_with_callee_type(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1474, in check_call_expr_with_callee_type
    ret_type, callee_type = self.check_call(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1572, in check_call
    return self.check_callable_call(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1786, in check_callable_call
    arg_types = self.infer_arg_types_in_context(callee, args, arg_kinds, formal_to_actual)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1960, in infer_arg_types_in_context
    res[ai] = self.accept(args[ai], arg_type)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 5885, in accept
    typ = node.accept(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 2313, in accept
    return visitor.visit_list_expr(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 4980, in visit_list_expr
    return self.check_lst_expr(e, "builtins.list", "<list>")
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 5046, in check_lst_expr
    out = self.check_call(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1572, in check_call
    return self.check_callable_call(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1757, in check_callable_call
    callee = self.infer_function_type_arguments(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 2073, in infer_function_type_arguments
    arg_types = self.infer_arg_types_in_context(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1960, in infer_arg_types_in_context
    res[ai] = self.accept(args[ai], arg_type)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 5885, in accept
    typ = node.accept(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 1984, in accept
    return visitor.visit_call_expr(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 483, in visit_call_expr
    return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 617, in visit_call_expr_inner
    ret_type = self.check_call_expr_with_callee_type(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1474, in check_call_expr_with_callee_type
    ret_type, callee_type = self.check_call(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1572, in check_call
    return self.check_callable_call(
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1786, in check_callable_call
    arg_types = self.infer_arg_types_in_context(callee, args, arg_kinds, formal_to_actual)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 1960, in infer_arg_types_in_context
    res[ai] = self.accept(args[ai], arg_type)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 5885, in accept
    typ = node.accept(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 1984, in accept
    return visitor.visit_call_expr(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 483, in visit_call_expr
    return self.visit_call_expr_inner(e, allow_none_return=allow_none_return)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 573, in visit_call_expr_inner
    self.accept(e.callee, type_context, always_allow_any=True, is_callee=True)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 5885, in accept
    typ = node.accept(self)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 1908, in accept
    return visitor.visit_member_expr(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 3282, in visit_member_expr
    result = self.analyze_ordinary_member_access(e, is_lvalue)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkexpr.py", line 3307, in analyze_ordinary_member_access
    member_type = analyze_member_access(
        e.name,
    ...<10 lines>...
        is_self=is_self,
    )
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkmember.py", line 206, in analyze_member_access
    result = _analyze_member_access(name, typ, mx, override_info)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkmember.py", line 225, in _analyze_member_access
    return analyze_instance_member_access(name, typ, mx, override_info)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkmember.py", line 356, in analyze_instance_member_access
    return analyze_member_var_access(name, typ, info, mx)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkmember.py", line 537, in analyze_member_var_access
    return analyze_var(name, v, itype, info, mx, implicit=implicit)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/checkmember.py", line 814, in analyze_var
    dispatched_type = meet.meet_types(mx.original_type, itype)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/meet.py", line 96, in meet_types
    if is_proper_subtype(s, t, ignore_promotions=True):
       ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 222, in is_proper_subtype
    return _is_subtype(left, right, subtype_context, proper_subtype=True)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 350, in _is_subtype
    return left.accept(SubtypeVisitor(orig_right, subtype_context, proper_subtype))
           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/types.py", line 1470, in accept
    return visitor.visit_instance(self)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 595, in visit_instance
    if not check_type_parameter(
           ~~~~~~~~~~~~~~~~~~~~^
        lefta, righta, COVARIANT, self.proper_subtype, self.subtype_context
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ):
    ^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 367, in check_type_parameter
    return is_proper_subtype(left, right, subtype_context=subtype_context)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 222, in is_proper_subtype
    return _is_subtype(left, right, subtype_context, proper_subtype=True)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 350, in _is_subtype
    return left.accept(SubtypeVisitor(orig_right, subtype_context, proper_subtype))
           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/types.py", line 779, in accept
    return visitor.visit_param_spec(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 652, in visit_param_spec
    return self._is_subtype(left.prefix, right.prefix)
           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 412, in _is_subtype
    return is_proper_subtype(left, right, subtype_context=self.subtype_context)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 222, in is_proper_subtype
    return _is_subtype(left, right, subtype_context, proper_subtype=True)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 350, in _is_subtype
    return left.accept(SubtypeVisitor(orig_right, subtype_context, proper_subtype))
           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/types.py", line 1756, in accept
    return visitor.visit_parameters(self)
           ~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 674, in visit_parameters
    return are_parameters_compatible(
        left,
    ...<4 lines>...
        ignore_pos_arg_names=self.subtype_context.ignore_pos_arg_names,
    )
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 1680, in are_parameters_compatible
    if not are_args_compatible(
           ~~~~~~~~~~~~~~~~~~~^
        left_arg,
        ^^^^^^^^^
    ...<4 lines>...
        allow_imprecise_kinds=right.imprecise_arg_kinds,
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    ):
    ^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 1840, in are_args_compatible
    return is_compat(right.typ, left.typ)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 412, in _is_subtype
    return is_proper_subtype(left, right, subtype_context=self.subtype_context)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 222, in is_proper_subtype
    return _is_subtype(left, right, subtype_context, proper_subtype=True)
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 350, in _is_subtype
    return left.accept(SubtypeVisitor(orig_right, subtype_context, proper_subtype))
           ~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/types.py", line 1470, in accept
    return visitor.visit_instance(self)
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/subtypes.py", line 455, in visit_instance
    if left.type.fallback_to_any and not self.proper_subtype:
       ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/andreas/src/env-3.13/lib/python3.13/site-packages/mypy/nodes.py", line 3516, in __getattribute__
    raise AssertionError(object.__getattribute__(self, "msg"))
AssertionError: De-serialization failure: TypeInfo not fixed
pytato/scalar_expr.py:217: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 1.14.0+dev.b59878ec74bc4dd4dc3eafc1d3cdb2668da5f60a

To Reproduce

I ran into this using a pile of WIP branches on my machine. If you need a (big gnarly messy) reproducer, I can try and push those branches up.

Your Environment

  • Mypy version used: 1.14.0+dev.b59878ec74bc4dd4dc3eafc1d3cdb2668da5f60a
  • Mypy command-line flags:
  • Mypy configuration options from mypy.ini (and other config files):
[tool.mypy]
strict = true
warn_unused_ignores = true

[[tool.mypy.overrides]]
module = [
  "islpy",
  "pyopencl.*",
  "jax.*",
  "pygments.*",
  "mako.*",
]
ignore_missing_imports = true

[[tool.mypy.overrides]]
module = [
  "pytato.transform",
]
allow_subclassing_any = true


[[tool.mypy.overrides]]
module = [
  "pytato.raising",
]
# We'll be getting rid of it, no point in fixing it.
ignore_errors = true
  • Python version used: 3.13
  • Operating system and version: Debian testing/unstable

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions