-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
crashpriority-1-normaltopic-pluginsThe plugin API and ideas for new pluginsThe plugin API and ideas for new plugins
Description
Please provide more information to help us understand the issue:
- Are you reporting a bug, or opening a feature request?
A 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.
import dataclasses
@dataclasses.dataclass
class MyClass:
a: dataclasses.InitVar[int]
_a: int = dataclasses.field(init=False)
def __post_init__(self, a):
self._a = a
@dataclasses.dataclass(init=False)
class MySubClass(MyClass):
b: dataclasses.InitVar[int]
_b: int = dataclasses.field(init=False)
def __init__(self, b):
super().__init__(b+1)
self._b = b- What is the actual behavior/output?
Mypy crashes with an assertion error.
-
What is the behavior/output you expect?
I expect type checking to happen, etc. -
What are the versions of mypy and Python you are using?
mypy 0.750+dev.596cde6bd8ddcdbbe5ca2b0d0019ec689a7e8b9c
Python 3.8.0
If I downgrade to 0.740, I see the same error.
- What are the mypy flags you are using? (For example --strict-optional)
No flags.
- If mypy crashed with a traceback, please paste
the full traceback below.
crash_mypy_2.py:14: error: INTERNAL ERROR -- Please try using mypy master on Github:
https://mypy.rtfd.io/en/latest/common_issues.html#using-a-development-mypy-build
Please report a bug at https://github.com/python/mypy/issues
version: 0.750+dev.596cde6bd8ddcdbbe5ca2b0d0019ec689a7e8b9c
Traceback (most recent call last):
File "/Users/jake/.pyenv/versions/dbt38/bin/mypy", line 11, in <module>
load_entry_point('mypy', 'console_scripts', 'mypy')()
File "/Users/jake/src/mypy/mypy/__main__.py", line 8, in console_entry
main(None, sys.stdout, sys.stderr)
File "/Users/jake/src/mypy/mypy/main.py", line 89, in main
res = build.build(sources, options, None, flush_errors, fscache, stdout, stderr)
File "/Users/jake/src/mypy/mypy/build.py", line 166, in build
result = _build(
File "/Users/jake/src/mypy/mypy/build.py", line 235, in _build
graph = dispatch(sources, manager, stdout)
File "/Users/jake/src/mypy/mypy/build.py", line 2620, in dispatch
process_graph(graph, manager)
File "/Users/jake/src/mypy/mypy/build.py", line 2929, in process_graph
process_stale_scc(graph, scc, manager)
File "/Users/jake/src/mypy/mypy/build.py", line 3022, in process_stale_scc
mypy.semanal_main.semantic_analysis_for_scc(graph, scc, manager.errors)
File "/Users/jake/src/mypy/mypy/semanal_main.py", line 77, in semantic_analysis_for_scc
process_top_levels(graph, scc, patches)
File "/Users/jake/src/mypy/mypy/semanal_main.py", line 198, in process_top_levels
deferred, incomplete, progress = semantic_analyze_target(next_id, state,
File "/Users/jake/src/mypy/mypy/semanal_main.py", line 325, in semantic_analyze_target
analyzer.refresh_partial(refresh_node,
File "/Users/jake/src/mypy/mypy/semanal.py", line 378, in refresh_partial
self.refresh_top_level(node)
File "/Users/jake/src/mypy/mypy/semanal.py", line 389, in refresh_top_level
self.accept(d)
File "/Users/jake/src/mypy/mypy/semanal.py", line 4659, in accept
node.accept(self)
File "/Users/jake/src/mypy/mypy/nodes.py", line 939, in accept
return visitor.visit_class_def(self)
File "/Users/jake/src/mypy/mypy/semanal.py", line 1029, in visit_class_def
self.analyze_class(defn)
File "/Users/jake/src/mypy/mypy/semanal.py", line 1106, in analyze_class
self.analyze_class_body_common(defn)
File "/Users/jake/src/mypy/mypy/semanal.py", line 1115, in analyze_class_body_common
self.apply_class_plugin_hooks(defn)
File "/Users/jake/src/mypy/mypy/semanal.py", line 1161, in apply_class_plugin_hooks
hook(ClassDefContext(defn, decorator, self))
File "/Users/jake/src/mypy/mypy/plugins/dataclasses.py", line 374, in dataclass_class_maker_callback
transformer.transform()
File "/Users/jake/src/mypy/mypy/plugins/dataclasses.py", line 87, in transform
assert attr.is_init_var and not attr.is_in_init
Metadata
Metadata
Assignees
Labels
crashpriority-1-normaltopic-pluginsThe plugin API and ideas for new pluginsThe plugin API and ideas for new plugins