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
Following code raises INTERNAL ERROR on version 0.800 but not on 0.790
DRIVE_TYPE = TypeVar('DRIVE_TYPE', bound='Driver')
# This WORKS
# DRIVER_STATE_TYPE = TypeVar('DRIVER_STATE_TYPE', bound='DriverState')
@dataclass
class DriverState(Generic[DRIVE_TYPE]):
driver: DRIVE_TYPE
pid: str = ''
# This doesn't work
DRIVER_STATE_TYPE = TypeVar('DRIVER_STATE_TYPE', bound='DriverState')
@dataclass
class Driver(Generic[DRIVER_STATE_TYPE]):
config: DRIVER_STATE_TYPE
@dataclass
class ESState(DriverState['ESDriver']):
special_name: str = 'ES Driver'
@dataclass
class ESDriver(Driver[
ESState
]):
def name(self) -> None:
print(self.config.special_name)
Is it because supertype not recursively expanded? I believe this has something to do with the fix #7520.
Traceback
mypyissue.py:32: 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.800
Traceback (most recent call last):
File "mypy/semanal.py", line 4835, in accept
File "mypy/nodes.py", line 950, in accept
File "mypy/semanal.py", line 1048, in visit_class_def
File "mypy/semanal.py", line 1125, in analyze_class
File "mypy/semanal.py", line 1134, in analyze_class_body_common
File "mypy/semanal.py", line 1180, in apply_class_plugin_hooks
File "mypy/plugins/dataclasses.py", line 361, in dataclass_class_maker_callback
File "mypy/plugins/dataclasses.py", line 100, in transform
File "mypy/plugins/dataclasses.py", line 302, in collect_attributes
File "mypy/plugins/dataclasses.py", line 86, in expand_typevar_from_subtype
File "mypy/typeops.py", line 165, in map_type_from_supertype
File "mypy/maptype.py", line 24, in map_instance_to_supertype
File "mypy/maptype.py", line 37, in map_instance_to_supertypes
File "mypy/maptype.py", line 82, in map_instance_to_direct_supertypes
File "mypy/expandtype.py", line 16, in expand_type
File "mypy/types.py", line 833, in accept
File "mypy/expandtype.py", line 85, in visit_instance
File "mypy/expandtype.py", line 145, in expand_types
File "mypy/types.py", line 1942, in accept
AssertionError:
mypyissue.py:32: : note: use --pdb to drop into pdb
Your Environment
Mypy version used: v0.800
Mypy command-line flags:
Mypy configuration options from mypy.ini (and other config files):
Python version used: Python 3.8.5
Operating system and version: MacOS
The text was updated successfully, but these errors were encountered:
This reveals it to be exactly the same crash as #12685. Happily, this was fixed in #12762; and since the stack trace and minimized repro are both identical, I don't think we need to add another test case.
Crash Report
Following code raises INTERNAL ERROR on version 0.800 but not on 0.790
Is it because
supertype
not recursively expanded? I believe this has something to do with the fix #7520.Traceback
Your Environment
mypy.ini
(and other config files):The text was updated successfully, but these errors were encountered: