Repository navigation
AssertionError: All arguments must be fully typed #6809
Copy link
Copy link
Closed
Labels
crashpriority-0-hightopic-pluginsThe plugin API and ideas for new pluginsThe plugin API and ideas for new plugins
Description
- Are you reporting a bug, or opening a feature request? bug
- Please insert below the code you are checking with mypy,
or a mock-up repro if the source is private. We would appreciate
if you try to simplify your case to a minimal repro.
from dataclasses import dataclass
@dataclass(frozen=True)
class Modifiers:
pass
@dataclass(frozen=True)
class Buff:
modifiers: Modifiers
@dataclass(frozen=True)
class HB(Buff):
modifiers = Modifiers()
- What is the actual behavior/output?
bug.py:11: error: INTERNAL ERROR -- please report a bug at https://github.com/python/mypy/issues version: 0.701
Traceback (most recent call last):
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/bin/mypy", line 10, in <module>
sys.exit(console_entry())
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/__main__.py", line 7, in console_entry
main(None)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/main.py", line 84, in main
res = build.build(sources, options, None, flush_errors, fscache)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/build.py", line 163, in build
result = _build(sources, options, alt_lib_path, flush_errors, fscache)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/build.py", line 218, in _build
graph = dispatch(sources, manager)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/build.py", line 2461, in dispatch
process_graph(graph, manager)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/build.py", line 2761, in process_graph
process_stale_scc(graph, scc, manager)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/build.py", line 2862, in process_stale_scc
graph[id].semantic_analysis()
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/build.py", line 1997, in semantic_analysis
self.manager.semantic_analyzer.visit_file(self.tree, self.xpath, self.options, patches)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/semanal.py", line 309, in visit_file
self.accept(d)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/semanal.py", line 3791, in accept
node.accept(self)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/nodes.py", line 896, in accept
return visitor.visit_class_def(self)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/semanal.py", line 807, in visit_class_def
self.analyze_class(defn)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/semanal.py", line 825, in analyze_class
self.analyze_class_body_common(defn)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/semanal.py", line 833, in analyze_class_body_common
self.apply_class_plugin_hooks(defn)
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/semanal.py", line 895, in apply_class_plugin_hooks
hook(ClassDefContext(defn, decorator, self))
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/plugins/dataclasses.py", line 330, in dataclass_class_maker_callback
transformer.transform()
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/plugins/dataclasses.py", line 100, in transform
return_type=NoneTyp(),
File "/Users/ezyang/Dev/oss/dl-hmc-calc-env/lib/python3.7/site-packages/mypy/plugins/common.py", line 97, in add_method
assert arg.type_annotation, 'All arguments must be fully typed.'
AssertionError: All arguments must be fully typed.
bug.py:11: : note: use --pdb to drop into pdb
- What is the behavior/output you expect?
No crash
- What are the versions of mypy and Python you are using?
(/Users/ezyang/Dev/oss/dl-hmc-calc-env) MacBook-Pro-116:dl-hmc-calc ezyang$ python --version
Python 3.7.3
(/Users/ezyang/Dev/oss/dl-hmc-calc-env) MacBook-Pro-116:dl-hmc-calc ezyang$ mypy --version
mypy 0.701
- Do you see the same issue after installing mypy from Git master?
I didn't try.
- What are the mypy flags you are using? (For example --strict-optional)
None
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
crashpriority-0-hightopic-pluginsThe plugin API and ideas for new pluginsThe plugin API and ideas for new plugins
Activity
[-]dataclass without types gets AssertionError: All arguments must be fully typed.[/-][+]AssertionError: All arguments must be fully typed.[/+]ilevkivskyi commentedon May 10, 2019
Thanks for reporting! This is quite bad crash, also it is interesting that it also crashes with a different traceback if one uses
--new-semantic-analyzer:kbakk commentedon Jan 6, 2020
Hi,
I'm able to reproduce this with master branch (300c846), the output is a bit different from the previously posted (same example code as @ezyang):
[-]AssertionError: All arguments must be fully typed.[/-][+]AssertionError: All arguments must be fully typed[/+]msullivan commentedon Jan 8, 2020
Probably we want to produce an error here, since the assignment
HBdoesn't accomplish anything?Fix some crashes in dataclasses
Fix some crashes in dataclasses
Fix some crashes in dataclasses
Fix some crashes in dataclasses (#8271)