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

feat: add mapped_type_vars to TypeInfo #18274

Closed
wants to merge 2 commits into from
Closed

Conversation

Lancetnik
Copy link

@sterliakov I don't think, that your checker-based solution works perfectly in all cases (#18270)
I want to propose a new TypeInfo field, that should contains a real mapping for all MRO current class type variables

I think, we can calculate real type for all typevars and propogate it from inheritor to parents recursively:

class A[T1]:
    # mapped_type_vars = {T1: str}
    
class B[T2]:
    # mapped_type_vars = {T2: T4}

class C[T3](B[T3]):
    # mapped_type_vars = {T3: T4}

class D[T4](C[T4], A[str]):
    # mapped_type_vars = {}

This field can be calculated at MRO build phase and used in checker lately. Also, It may be helpful not for the compatibility-checker only, but for another checks as well.

Also, new field shouldn't break already existed checks - we can migrate to its' usage progressively in the future.

If you are okay with such decision, we can collaborate and work on the fix together - I don't familiar enough with mypy codebase, but would like to dig into and contribute more in the future. But, seems like I need your help to finalize the current problem solution.

@Lancetnik
Copy link
Author

As a part of #18268 fix

Copy link
Contributor

github-actions bot commented Dec 9, 2024

Diff from mypy_primer, showing the effect of this PR on open source code:

git-revise (https://github.com/mystor/git-revise)
- gitrevise/odb.py:60: error: Unused "type: ignore" comment  [unused-ignore]
- gitrevise/odb.py:498: error: Redundant cast to "GitObjT"  [redundant-cast]
+ /tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/typeshed/stdlib/typing.pyi:408: 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.2b5f414bb8fdeb251b7e31b602ebfa691c84c6bd
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2940, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3338, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3433, in process_stale_scc
+     mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
+   File "/semanal_main.py", line 93, in semantic_analysis_for_scc
+     process_top_levels(graph, scc, patches)
+   File "/semanal_main.py", line 220, in process_top_levels
+     deferred, incomplete, progress = semantic_analyze_target(
+   File "/semanal_main.py", line 351, in semantic_analyze_target
+     analyzer.refresh_partial(
+   File "/semanal.py", line 646, in refresh_partial
+     self.refresh_top_level(node)
+   File "/semanal.py", line 657, in refresh_top_level
+     self.accept(d)
+   File "/semanal.py", line 7286, in accept
+     node.accept(self)
+   File "/nodes.py", line 1196, in accept
+     return visitor.visit_class_def(self)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/semanal.py", line 1787, in visit_class_def
+     self.analyze_class(defn)
+   File "/semanal.py", line 1987, in analyze_class
+     self.configure_base_classes(defn, base_types)
+   File "/semanal.py", line 2626, in configure_base_classes
+     self.calculate_class_mro(defn, self.object_type)
+   File "/semanal.py", line 2668, in calculate_class_mro
+     calculate_mro(defn.info, obj_type)
+   File "/mro.py", line 18, in calculate_mro
+     fill_mapped_type_vars(info)
+   File "/mro.py", line 50, in fill_mapped_type_vars
+     final_mapped_type_vars[k] = _resolve_mappped_vars(info.mapped_type_vars, v)
+                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   [Previous line repeated 16357 more times]
+   File "/mro.py", line 68, in _resolve_mappped_vars
+     if key in mapped_type_vars:
+        ^^^^^^^^^^^^^^^^^^^^^^^
+   File "/types.py", line 658, in __hash__
+     return hash((self.id, self.upper_bound, tuple(self.values)))
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ RecursionError: maximum recursion depth exceeded

dacite (https://github.com/konradhalas/dacite)
- dacite/config.py:8: error: Unused "type: ignore" comment  [unused-ignore]
- dacite/types.py:52: error: Unused "type: ignore" comment  [unused-ignore]
- dacite/types.py:67: error: Unused "type: ignore" comment  [unused-ignore]
- dacite/types.py:161: error: Unused "type: ignore" comment  [unused-ignore]
- dacite/dataclasses.py:17: error: Unused "type: ignore" comment  [unused-ignore]
- dacite/dataclasses.py:18: error: Unused "type: ignore" comment  [unused-ignore]
+ /tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/typeshed/stdlib/typing.pyi:408: 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.2b5f414bb8fdeb251b7e31b602ebfa691c84c6bd
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2940, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3338, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3433, in process_stale_scc
+     mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
+   File "/semanal_main.py", line 93, in semantic_analysis_for_scc
+     process_top_levels(graph, scc, patches)
+   File "/semanal_main.py", line 220, in process_top_levels
+     deferred, incomplete, progress = semantic_analyze_target(
+   File "/semanal_main.py", line 351, in semantic_analyze_target
+     analyzer.refresh_partial(
+   File "/semanal.py", line 646, in refresh_partial
+     self.refresh_top_level(node)
+   File "/semanal.py", line 657, in refresh_top_level
+     self.accept(d)
+   File "/semanal.py", line 7286, in accept
+     node.accept(self)
+   File "/nodes.py", line 1196, in accept
+     return visitor.visit_class_def(self)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/semanal.py", line 1787, in visit_class_def
+     self.analyze_class(defn)
+   File "/semanal.py", line 1987, in analyze_class
+     self.configure_base_classes(defn, base_types)
+   File "/semanal.py", line 2626, in configure_base_classes
+     self.calculate_class_mro(defn, self.object_type)
+   File "/semanal.py", line 2668, in calculate_class_mro
+     calculate_mro(defn.info, obj_type)
+   File "/mro.py", line 18, in calculate_mro
+     fill_mapped_type_vars(info)
+   File "/mro.py", line 50, in fill_mapped_type_vars
+     final_mapped_type_vars[k] = _resolve_mappped_vars(info.mapped_type_vars, v)
+                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   [Previous line repeated 16357 more times]
+   File "/mro.py", line 68, in _resolve_mappped_vars
+     if key in mapped_type_vars:
+        ^^^^^^^^^^^^^^^^^^^^^^^
+   File "/types.py", line 658, in __hash__
+     return hash((self.id, self.upper_bound, tuple(self.values)))
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ RecursionError: maximum recursion depth exceeded

janus (https://github.com/aio-libs/janus)
+ /tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/typeshed/stdlib/typing.pyi:408: 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.2b5f414bb8fdeb251b7e31b602ebfa691c84c6bd
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2940, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3338, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3433, in process_stale_scc
+     mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
+   File "/semanal_main.py", line 93, in semantic_analysis_for_scc
+     process_top_levels(graph, scc, patches)
+   File "/semanal_main.py", line 220, in process_top_levels
+     deferred, incomplete, progress = semantic_analyze_target(
+   File "/semanal_main.py", line 351, in semantic_analyze_target
+     analyzer.refresh_partial(
+   File "/semanal.py", line 646, in refresh_partial
+     self.refresh_top_level(node)
+   File "/semanal.py", line 657, in refresh_top_level
+     self.accept(d)
+   File "/semanal.py", line 7286, in accept
+     node.accept(self)
+   File "/nodes.py", line 1196, in accept
+     return visitor.visit_class_def(self)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/semanal.py", line 1787, in visit_class_def
+     self.analyze_class(defn)
+   File "/semanal.py", line 1987, in analyze_class
+     self.configure_base_classes(defn, base_types)
+   File "/semanal.py", line 2626, in configure_base_classes
+     self.calculate_class_mro(defn, self.object_type)
+   File "/semanal.py", line 2668, in calculate_class_mro
+     calculate_mro(defn.info, obj_type)
+   File "/mro.py", line 18, in calculate_mro
+     fill_mapped_type_vars(info)
+   File "/mro.py", line 50, in fill_mapped_type_vars
+     final_mapped_type_vars[k] = _resolve_mappped_vars(info.mapped_type_vars, v)
+                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   [Previous line repeated 16357 more times]
+   File "/mro.py", line 68, in _resolve_mappped_vars
+     if key in mapped_type_vars:
+        ^^^^^^^^^^^^^^^^^^^^^^^
+   File "/types.py", line 658, in __hash__
+     return hash((self.id, self.upper_bound, tuple(self.values)))
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ RecursionError: maximum recursion depth exceeded

zipp (https://github.com/jaraco/zipp)
+ /tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/typeshed/stdlib/typing.pyi:408: 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.2b5f414bb8fdeb251b7e31b602ebfa691c84c6bd
+ note: use --pdb to drop into pdb
- tests/test_path.py:646: error: Name "zipfile.ZipInfo" is not defined  [name-defined]
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2940, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3338, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3433, in process_stale_scc
+     mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
+   File "/semanal_main.py", line 93, in semantic_analysis_for_scc
+     process_top_levels(graph, scc, patches)
+   File "/semanal_main.py", line 220, in process_top_levels
+     deferred, incomplete, progress = semantic_analyze_target(
+   File "/semanal_main.py", line 351, in semantic_analyze_target
+     analyzer.refresh_partial(
+   File "/semanal.py", line 646, in refresh_partial
+     self.refresh_top_level(node)
+   File "/semanal.py", line 657, in refresh_top_level
+     self.accept(d)
+   File "/semanal.py", line 7286, in accept
+     node.accept(self)
+   File "/nodes.py", line 1196, in accept
+     return visitor.visit_class_def(self)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/semanal.py", line 1787, in visit_class_def
+     self.analyze_class(defn)
+   File "/semanal.py", line 1987, in analyze_class
+     self.configure_base_classes(defn, base_types)
+   File "/semanal.py", line 2626, in configure_base_classes
+     self.calculate_class_mro(defn, self.object_type)
+   File "/semanal.py", line 2668, in calculate_class_mro
+     calculate_mro(defn.info, obj_type)
+   File "/mro.py", line 18, in calculate_mro
+     fill_mapped_type_vars(info)
+   File "/mro.py", line 50, in fill_mapped_type_vars
+     final_mapped_type_vars[k] = _resolve_mappped_vars(info.mapped_type_vars, v)
+                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   [Previous line repeated 16357 more times]
+   File "/mro.py", line 68, in _resolve_mappped_vars
+     if key in mapped_type_vars:
+        ^^^^^^^^^^^^^^^^^^^^^^^
+   File "/types.py", line 658, in __hash__
+     return hash((self.id, self.upper_bound, tuple(self.values)))
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ RecursionError: maximum recursion depth exceeded

websockets (https://github.com/aaugustin/websockets): 4.85x faster (17.2s -> 3.5s in a single noisy sample)
+ /tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/typeshed/stdlib/typing.pyi:408: 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.2b5f414bb8fdeb251b7e31b602ebfa691c84c6bd
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2940, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3338, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3433, in process_stale_scc
+     mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
+   File "/semanal_main.py", line 93, in semantic_analysis_for_scc
+     process_top_levels(graph, scc, patches)
+   File "/semanal_main.py", line 220, in process_top_levels
+     deferred, incomplete, progress = semantic_analyze_target(
+   File "/semanal_main.py", line 351, in semantic_analyze_target
+     analyzer.refresh_partial(
+   File "/semanal.py", line 646, in refresh_partial
+     self.refresh_top_level(node)
+   File "/semanal.py", line 657, in refresh_top_level
+     self.accept(d)
+   File "/semanal.py", line 7286, in accept
+     node.accept(self)
+   File "/nodes.py", line 1196, in accept
+     return visitor.visit_class_def(self)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/semanal.py", line 1787, in visit_class_def
+     self.analyze_class(defn)
+   File "/semanal.py", line 1987, in analyze_class
+     self.configure_base_classes(defn, base_types)
+   File "/semanal.py", line 2626, in configure_base_classes
+     self.calculate_class_mro(defn, self.object_type)
+   File "/semanal.py", line 2668, in calculate_class_mro
+     calculate_mro(defn.info, obj_type)
+   File "/mro.py", line 18, in calculate_mro
+     fill_mapped_type_vars(info)
+   File "/mro.py", line 50, in fill_mapped_type_vars
+     final_mapped_type_vars[k] = _resolve_mappped_vars(info.mapped_type_vars, v)
+                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   [Previous line repeated 16357 more times]
+   File "/mro.py", line 68, in _resolve_mappped_vars
+     if key in mapped_type_vars:
+        ^^^^^^^^^^^^^^^^^^^^^^^
+   File "/types.py", line 658, in __hash__
+     return hash((self.id, self.upper_bound, tuple(self.values)))
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ RecursionError: maximum recursion depth exceeded

mypy_primer (https://github.com/hauntsaninja/mypy_primer)
- mypy_primer/utils.py:173: error: Unused "type: ignore" comment  [unused-ignore]
+ /tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/typeshed/stdlib/typing.pyi:408: 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.2b5f414bb8fdeb251b7e31b602ebfa691c84c6bd
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2940, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3338, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3433, in process_stale_scc
+     mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
+   File "/semanal_main.py", line 93, in semantic_analysis_for_scc
+     process_top_levels(graph, scc, patches)
+   File "/semanal_main.py", line 220, in process_top_levels
+     deferred, incomplete, progress = semantic_analyze_target(
+   File "/semanal_main.py", line 351, in semantic_analyze_target
+     analyzer.refresh_partial(
+   File "/semanal.py", line 646, in refresh_partial
+     self.refresh_top_level(node)
+   File "/semanal.py", line 657, in refresh_top_level
+     self.accept(d)
+   File "/semanal.py", line 7286, in accept
+     node.accept(self)
+   File "/nodes.py", line 1196, in accept
+     return visitor.visit_class_def(self)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/semanal.py", line 1787, in visit_class_def
+     self.analyze_class(defn)
+   File "/semanal.py", line 1987, in analyze_class
+     self.configure_base_classes(defn, base_types)
+   File "/semanal.py", line 2626, in configure_base_classes
+     self.calculate_class_mro(defn, self.object_type)
+   File "/semanal.py", line 2668, in calculate_class_mro
+     calculate_mro(defn.info, obj_type)
+   File "/mro.py", line 18, in calculate_mro
+     fill_mapped_type_vars(info)
+   File "/mro.py", line 50, in fill_mapped_type_vars
+     final_mapped_type_vars[k] = _resolve_mappped_vars(info.mapped_type_vars, v)
+                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   [Previous line repeated 16357 more times]
+   File "/mro.py", line 68, in _resolve_mappped_vars
+     if key in mapped_type_vars:
+        ^^^^^^^^^^^^^^^^^^^^^^^
+   File "/types.py", line 658, in __hash__
+     return hash((self.id, self.upper_bound, tuple(self.values)))
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ RecursionError: maximum recursion depth exceeded

CPython (Argument Clinic) (https://github.com/python/cpython)
+ /tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/typeshed/stdlib/typing.pyi:408: 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.2b5f414bb8fdeb251b7e31b602ebfa691c84c6bd
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2940, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3338, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3433, in process_stale_scc
+     mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
+   File "/semanal_main.py", line 93, in semantic_analysis_for_scc
+     process_top_levels(graph, scc, patches)
+   File "/semanal_main.py", line 220, in process_top_levels
+     deferred, incomplete, progress = semantic_analyze_target(
+   File "/semanal_main.py", line 351, in semantic_analyze_target
+     analyzer.refresh_partial(
+   File "/semanal.py", line 646, in refresh_partial
+     self.refresh_top_level(node)
+   File "/semanal.py", line 657, in refresh_top_level
+     self.accept(d)
+   File "/semanal.py", line 7286, in accept
+     node.accept(self)
+   File "/nodes.py", line 1196, in accept
+     return visitor.visit_class_def(self)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/semanal.py", line 1787, in visit_class_def
+     self.analyze_class(defn)
+   File "/semanal.py", line 1987, in analyze_class
+     self.configure_base_classes(defn, base_types)
+   File "/semanal.py", line 2626, in configure_base_classes
+     self.calculate_class_mro(defn, self.object_type)
+   File "/semanal.py", line 2668, in calculate_class_mro
+     calculate_mro(defn.info, obj_type)
+   File "/mro.py", line 18, in calculate_mro
+     fill_mapped_type_vars(info)
+   File "/mro.py", line 50, in fill_mapped_type_vars
+     final_mapped_type_vars[k] = _resolve_mappped_vars(info.mapped_type_vars, v)
+                                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/mro.py", line 69, in _resolve_mappped_vars
+     return _resolve_mappped_vars(mapped_type_vars, mapped_type_vars[key])
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   [Previous line repeated 16357 more times]
+   File "/mro.py", line 68, in _resolve_mappped_vars
+     if key in mapped_type_vars:
+        ^^^^^^^^^^^^^^^^^^^^^^^
+   File "/types.py", line 658, in __hash__
+     return hash((self.id, self.upper_bound, tuple(self.values)))
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+ RecursionError: maximum recursion depth exceeded

pycryptodome (https://github.com/Legrandin/pycryptodome): 4.43x faster (19.5s -> 4.4s in a single noisy sample)
- lib/Crypto/SelfTest/Hash/test_BLAKE2.py:421: error: Unused "type: ignore" comment  [unused-ignore]
+ /tmp/mypy_primer/new_mypy/venv/lib/python3.12/site-packages/mypy/typeshed/stdlib/typing.pyi:408: 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.2b5f414bb8fdeb251b7e31b602ebfa691c84c6bd
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+   File "", line 8, in <module>
+     sys.exit(console_entry())
+   File "/__main__.py", line 15, in console_entry
+     main()
+   File "/main.py", line 109, in main
+     res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
+   File "/main.py", line 193, in run_build
+     res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
+   File "/build.py", line 194, in build
+     result = _build(
+   File "/build.py", line 269, in _build
+     graph = dispatch(sources, manager, stdout)
+   File "/build.py", line 2940, in dispatch
+     process_graph(graph, manager)
+   File "/build.py", line 3338, in process_graph
+     process_stale_scc(graph, scc, manager)
+   File "/build.py", line 3433, in process_stale_scc
+     mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
+   File "/semanal_main.py", line 93, in semantic_analysis_for_scc
+     process_top_levels(graph, scc, patches)
+   File "/semanal_main.py", line 220, in process_top_levels
+     deferred, incomplete, progress = semantic_analyze_target(
+   File "/semanal_main.py", line 351, in semantic_analyze_target
+     analyzer.refresh_partial(
+   File "/semanal.py", line 646, in refresh_partial
+     self.refresh_top_level(node)
+   File "/semanal.py", line 657, in refresh_top_level
+     self.accept(d)
+   File "/semanal.py", line 7286, in accept
+     node.accept(self)
+   File "/nodes.py", line 1196, in accept
+     return visitor.visit_class_def(self)
+            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+   File "/semanal.py", line 1787, in visit_class_def
+     self.analyze_class(defn)
+   File "/semanal.py", line 1987, in analyze_class
+     self.configure_base_classes(defn, base_types)
+   File "/semanal.py", line 2626, in configure_base_classes
+     self.calculate_class_mro(defn, self.object_type)
+   File "/semanal.py", line 2668, in calculate_class_mro
+     calculate_mro(defn.info, obj_type)
+   File "/mro.py", line 18, in calculate_mro
+     fill_mapped_type_vars(info)
+   File "/mro.py", line 50, in fill_mapped_type_vars

... (truncated 11816 lines) ...```

@Lancetnik Lancetnik closed this Dec 10, 2024
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

Successfully merging this pull request may close these issues.

1 participant