diff --git a/mypy/stubtest.py b/mypy/stubtest.py index ac0378cc5468..e63e109d504b 100644 --- a/mypy/stubtest.py +++ b/mypy/stubtest.py @@ -1851,7 +1851,7 @@ def is_probably_a_function(runtime: Any) -> bool: def is_read_only_property(runtime: object) -> bool: - return isinstance(runtime, property) and runtime.fset is None + return isinstance(runtime, property) and runtime.fset is None and runtime.fdel is None def safe_inspect_signature(runtime: Any) -> inspect.Signature | None: diff --git a/mypy/test/teststubtest.py b/mypy/test/teststubtest.py index ada69fc6e47c..d03fc253a6b4 100644 --- a/mypy/test/teststubtest.py +++ b/mypy/test/teststubtest.py @@ -1061,6 +1061,25 @@ class FineAndDandy: """, error=None, ) + yield Case( + stub=""" + class spam: + @property + def eggs(self) -> int: ... + @eggs.deleter + def eggs(self) -> None: ... + """, + runtime=""" + class spam: + @property + def eggs(self): + return 42 + @eggs.deleter + def eggs(self): + print("eggs") + """, + error=None, + ) @collect_cases def test_cached_property(self) -> Iterator[Case]: