Closed
Description
I noticed the following change in behavior after upgrading to 0.511
from 0.501
.
Using the following minimal example
$ cat abstractproperty.py |nl -b a
1 from abc import ABC
2 from abc import abstractmethod
3 from typing import List
4
5
6 class Test(ABC):
7
8 @property
9 def foo(self) -> List:
10 """Getter"""
11
12 @foo.setter # type: ignore
13 @abstractmethod
14 def foo(self, value: List) -> None:
15 """Setter"""
the new version of mypy gives the following error
abstractproperty.py:14: error: Function is missing a type annotation for one or more arguments
While the error itself is a bit unclear in terms of what exactly is missing the type annotation, attempting to ignore line 14 with a # type: ignore
comment
from abc import ABC
from abc import abstractmethod
from typing import List
class Test(ABC):
@property
def foo(self) -> List:
"""Getter"""
@foo.setter # type: ignore
@abstractmethod
def foo(self, value: List) -> None: # type: ignore
"""Setter"""
results in an AttributeError
Traceback (most recent call last):
File ".../bin/mypy", line 6, in <module>
main(__file__)
File ".../lib/python3.5/site-packages/mypy/main.py", line 46, in main
res = type_check_only(sources, bin_dir, options)
File ".../lib/python3.5/site-packages/mypy/main.py", line 93, in type_check_only
options=options)
File ".../lib/python3.5/site-packages/mypy/build.py", line 188, in build
graph = dispatch(sources, manager)
File ".../lib/python3.5/site-packages/mypy/build.py", line 1595, in dispatch
process_graph(graph, manager)
File ".../lib/python3.5/site-packages/mypy/build.py", line 1838, in process_graph
process_stale_scc(graph, scc, manager)
File ".../lib/python3.5/site-packages/mypy/build.py", line 1946, in process_stale_scc
graph[id].write_cache()
File ".../lib/python3.5/site-packages/mypy/build.py", line 1576, in write_cache
self.manager)
File ".../lib/python3.5/site-packages/mypy/build.py", line 875, in write_cache
data = tree.serialize()
File ".../lib/python3.5/site-packages/mypy/nodes.py", line 284, in serialize
'names': self.names.serialize(self._fullname),
File ".../lib/python3.5/site-packages/mypy/nodes.py", line 2377, in serialize
data[key] = value.serialize(fullname, key)
File ".../lib/python3.5/site-packages/mypy/nodes.py", line 2325, in serialize
data['node'] = self.node.serialize()
File ".../lib/python3.5/site-packages/mypy/nodes.py", line 2176, in serialize
'names': self.names.serialize(self.fullname()),
File ".../lib/python3.5/site-packages/mypy/nodes.py", line 2377, in serialize
data[key] = value.serialize(fullname, key)
File ".../lib/python3.5/site-packages/mypy/nodes.py", line 2325, in serialize
data['node'] = self.node.serialize()
File ".../lib/python3.5/site-packages/mypy/nodes.py", line 414, in serialize
'items': [i.serialize() for i in self.items],
File ".../lib/python3.5/site-packages/mypy/nodes.py", line 414, in <listcomp>
'items': [i.serialize() for i in self.items],
File ".../lib/python3.5/site-packages/mypy/nodes.py", line 636, in serialize
'func': self.func.serialize(),
File ".../lib/python3.5/site-packages/mypy/nodes.py", line 579, in serialize
'type': None if self.type is None else self.type.serialize(),
File ".../lib/python3.5/site-packages/mypy/types.py", line 766, in serialize
'fallback': self.fallback.serialize(),
AttributeError: 'NoneType' object has no attribute 'serialize'
My mypy.ini
has the following
[mypy]
disallow_subclassing_any = false
disallow_untyped_defs = true
follow_imports = skip
ignore_missing_imports = true
incremental = false
show_column_numbers = true
strict_optional = true
warn_no_return = false
warn_redundant_casts = true
warn_unused_ignores = true