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
A crash occurs when inheriting from a generic type that expects a single ParamSpec if too many type arguments are passed. The crash appears to only occur in an inheritance context (passing too many arguments in other contexts does not produce a crash) and when the parent type expects only a single ParamSpec (using additional type variables do not produce a crash).
Traceback
v1.11.2 Traceback
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.11.2
Traceback (most recent call last):
File "mypy/semanal.py", line 7087, in accept
File "mypy/nodes.py", line 1183, in accept
File "mypy/semanal.py", line 1700, in visit_class_def
File "mypy/semanal.py", line 1818, in analyze_class
File "mypy/semanal.py", line 2112, in clean_up_bases_and_infer_type_variables
File "mypy/semanal.py", line 7141, in analyze_type_expr
File "mypy/nodes.py", line 2028, in accept
File "mypy/semanal.py", line 5802, in visit_index_expr
File "mypy/semanal.py", line 5808, in analyze_type_application
File "mypy/semanal.py", line 5910, in analyze_type_application_args
File "mypy/types.py", line 1634, in __init__
AssertionError:
master (1.12.0+dev.0c10367) Traceback
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/__main__.py", line 37, in <module>
console_entry()
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/__main__.py", line 15, in console_entry
main()
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/main.py", line 102, in main
res, messages, blockers = run_build(sources, options, fscache, t0, stdout, stderr)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/main.py", line 186, in run_build
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/build.py", line 193, in build
result = _build(
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/build.py", line 268, in _build
graph = dispatch(sources, manager, stdout)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/build.py", line 2950, in dispatch
process_graph(graph, manager)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/build.py", line 3348, in process_graph
process_stale_scc(graph, scc, manager)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/build.py", line 3443, in process_stale_scc
mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal_main.py", line 93, in semantic_analysis_for_scc
process_top_levels(graph, scc, patches)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal_main.py", line 220, in process_top_levels
deferred, incomplete, progress = semantic_analyze_target(
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal_main.py", line 351, in semantic_analyze_target
analyzer.refresh_partial(
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 619, in refresh_partial
self.refresh_top_level(node)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 630, in refresh_top_level
self.accept(d)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 7087, in accept
node.accept(self)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/nodes.py", line 1183, in accept
return visitor.visit_class_def(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 1700, in visit_class_def
self.analyze_class(defn)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 1818, in analyze_class
bases, tvar_defs, is_protocol = self.clean_up_bases_and_infer_type_variables(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 2112, in clean_up_bases_and_infer_type_variables
self.analyze_type_expr(base_expr)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 7141, in analyze_type_expr
expr.accept(self)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/nodes.py", line 2028, in accept
return visitor.visit_index_expr(self)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 5802, in visit_index_expr
self.analyze_type_application(expr)
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 5808, in analyze_type_application
types = self.analyze_type_application_args(expr)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/semanal.py", line 5910, in analyze_type_application_args
types = [Parameters(types, [ARG_POS] * len(types), [None] * len(types))]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/layers/google.python.pip/pip/lib/python3.12/site-packages/mypy/types.py", line 1634, in __init__
assert not any(isinstance(t, Parameters) for t in arg_types)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
AssertionError:
main.py:13: 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.12.0+dev.0c1036717578b00e35625cc353a538e4eb63bc37
main.py:13: : note: use --pdb to drop into pdb
Crash Report
A crash occurs when inheriting from a generic type that expects a single
ParamSpec
if too many type arguments are passed. The crash appears to only occur in an inheritance context (passing too many arguments in other contexts does not produce a crash) and when the parent type expects only a singleParamSpec
(using additional type variables do not produce a crash).Traceback
v1.11.2 Traceback
master (1.12.0+dev.0c10367) Traceback
To Reproduce
Reproducers in mypy playground: v1.11.2,
master
Additionally, the following similar setups fail to reproduce the crash:
Non-reproducers
Your Environment
--show-traceback
mypy.ini
(and other config files): Defaults (confirmed bymypy --verbose
)The text was updated successfully, but these errors were encountered: