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
{{ message }}
Repository navigation
Segfault crash on specific recursive type situation #20107
Traceback from the interpreted version (current master - #b266dd):
Traceback (most recent call last):
File "/tmp/tmp.d9375bltfC/.venv/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/home/stas/Documents/Work/mypy/mypy/__main__.py", line 15, in console_entry
main()
File "/home/stas/Documents/Work/mypy/mypy/main.py", line 127, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/home/stas/Documents/Work/mypy/mypy/main.py", line 211, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/home/stas/Documents/Work/mypy/mypy/build.py", line 213, in build
result = _build(
File "/home/stas/Documents/Work/mypy/mypy/build.py", line 292, in _build
graph = dispatch(sources, manager, stdout)
File "/home/stas/Documents/Work/mypy/mypy/build.py", line 2931, in dispatch
process_graph(graph, manager)
File "/home/stas/Documents/Work/mypy/mypy/build.py", line 3322, in process_graph
done, still_working = manager.wait_for_done(graph)
File "/home/stas/Documents/Work/mypy/mypy/build.py", line 915, in wait_for_done
process_stale_scc(graph, next_scc, self)
File "/home/stas/Documents/Work/mypy/mypy/build.py", line 3460, in process_stale_scc
graph[id].type_check_first_pass()
File "/home/stas/Documents/Work/mypy/mypy/build.py", line 2322, in type_check_first_passself.type_checker().check_first_pass()
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 524, in check_first_passself.accept(d)
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 635, in accept
stmt.accept(self)
File "/home/stas/Documents/Work/mypy/mypy/nodes.py", line 971, in acceptreturn visitor.visit_func_def(self)
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 1192, in visit_func_defself._visit_func_def(defn)
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 1196, in _visit_func_defself.check_func_item(defn, name=defn.name)
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 1231, in check_func_itemself.check_func_def(defn, typ, name, allow_empty)
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 1504, in check_func_defself.accept(item.body)
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 635, in accept
stmt.accept(self)
File "/home/stas/Documents/Work/mypy/mypy/nodes.py", line 1542, in acceptreturn visitor.visit_block(self)
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 3127, in visit_blockself.accept(s)
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 635, in accept
stmt.accept(self)
~~~~~~~~~~~^^^^^^
File "/home/stas/Documents/Work/mypy/mypy/nodes.py", line 1810, in acceptreturn visitor.visit_if_stmt(self)
~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 5022, in visit_if_stmt
if_map, else_map =self.find_isinstance_check(e)
~~~~~~~~~~~~~~~~~~~~~~~~~~^^^
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 6281, in find_isinstance_check
if_map, else_map =self.find_isinstance_check_helper(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
node, in_boolean_context=in_boolean_context
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
)
^
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 6304, in find_isinstance_check_helper*self.conditional_types_with_intersection(
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^self.lookup_type(expr), self.get_isinstance_type(node.args[1]), expr
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
),
^
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 7841, in conditional_types_with_intersection
initial_types = conditional_types(
expr_type,
...<2 lines>...
consider_runtime_isinstance=consider_runtime_isinstance,
)
File "/home/stas/Documents/Work/mypy/mypy/checker.py", line 8220, in conditional_typeselifnot is_overlapping_types(current_type, proposed_type, ignore_promotions=True):
~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stas/Documents/Work/mypy/mypy/meet.py", line 630, in is_overlapping_typesifall(
~~~^
_is_overlapping_types(left_arg, right_arg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^for left_arg, right_arg inzip(left_args, right_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/home/stas/Documents/Work/mypy/mypy/meet.py", line 631, in <genexpr>
_is_overlapping_types(left_arg, right_arg)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/stas/Documents/Work/mypy/mypy/meet.py", line 433, in _is_overlapping_typesreturn is_overlapping_types(
left,
...<4 lines>...
seen_types=seen_types.copy(),
)
File "/home/stas/Documents/Work/mypy/mypy/meet.py", line 630, in is_overlapping_typesifall(
~~~^
_is_overlapping_types(left_arg, right_arg)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^for left_arg, right_arg inzip(left_args, right_args)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/home/stas/Documents/Work/mypy/mypy/meet.py", line 631, in <genexpr>
[... repeated many times]
File "/home/stas/Documents/Work/mypy/mypy/meet.py", line 631, in <genexpr>
_is_overlapping_types(left_arg, right_arg)
~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/stas/Documents/Work/mypy/mypy/meet.py", line 433, in _is_overlapping_typesreturn is_overlapping_types(
left,
...<4 lines>...
seen_types=seen_types.copy(),
)
File "/home/stas/Documents/Work/mypy/mypy/meet.py", line 403, in is_overlapping_typesif are_related_types(
~~~~~~~~~~~~~~~~~^
left, right, proper_subtype=overlap_for_overloads, ignore_promotions=ignore_promotions
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
):
^
File "/home/stas/Documents/Work/mypy/mypy/meet.py", line 319, in are_related_typesreturn is_subtype(left, right, ignore_promotions=ignore_promotions) or is_subtype(
~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/stas/Documents/Work/mypy/mypy/subtypes.py", line 148, in is_subtypeif left == right:
^^^^^^^^^^^^^
File "/home/stas/Documents/Work/mypy/mypy/types.py", line 1645, in __eq__self.type == other.type
RecursionError: maximum recursion depth exceeded in comparison
Activity
[-]Segfault crash on[/-][+]Segfault crash on specific recursive type situation[/+]A5rocks commentedon Oct 23, 2025
Slightly simpler reproducer:
sterliakov commentedon Oct 23, 2025
Traceback from the interpreted version (current master - #b266dd):
Remember the pair in `is_overlapping_types` if at least one of them i…