Repository navigation
Property setter not accepted if not next to getter #1465
Description
Activity
- added 8 commits that reference this issue
on Mar 16, 2017 #1713 has another example and some ideas.
What is the status of this issue? #1713 is closed as duplicate of this issue.
We don't have immediate plans for fix this issue, but we are happy to receive a PR.
- changed the title
[-]Wrong error for @smth.setter property[/-][+]Property setter not accepted if not next to getter[/+]on Aug 30, 2017 I had missed that moving the setter next to getter solves the problem, which is good enough. Thanks for the update!
30 remaining items
This also affects subclasses that override properties, e.g.:
class Parent(object): @property def foo(self): return "parent_foo" class Child(Parent): @Parent.foo.getter def foo(self): return "child_foo"
mypy returns a
"Callable[[Any], Any]" has no attribute "getter"error here. In this case, it's obviously not possible to move the two methods to be next to each other.Thanks for posting this - also struggling with this. Is there any known workaround? Specifically I wanted to override a property setter.
Reacted by Jordan Kail, Michael Dawson-Haggerty, Paul Rademacher, Jon Cluce and nk"No attribute" along with "Untyped decorator" error.
class Cell(ABC): def __init__(self, value: int | None = None): ... @property def value(self) -> int | None: return self._value class InputCell(Cell): @Cell.value.setter def value(self, value: int) -> None: ...Running mypy with
--strictgenerates:react.py:28: error: "Callable[[Cell], int | None]" has no attribute "setter" [attr-defined] react.py:28: error: Untyped decorator makes function "value" untyped [misc]Line 28 happens to be the
@Cell.value.setter.- added 2 commits that reference this issue
on Nov 12, 2023 - added a commit that references this issue
on Jun 26, 2024 - added a commit that references this issue
on Jun 26, 2024 - added a commit that references this issue
on Mar 5, 2026 - added 7 commits that reference this issue
on Jun 8, 2026
The following code incorrectly raises an error:
Error:
Commenting out the
_othermethod will fix the error.