Skip to content

Bug in PIE790 in Ruff v0.1.6 (... is meaningful in protocol methods and should not be removed) #8756

@kkom

Description

@kkom

Hey, I've got a regression in Ruff 0.1.6 to report.

PIE790 wants the ... removed, but it's necessary in this case – because foo is a protocol method:

from typing import Protocol

class Repro(Protocol):
    def foo(self) -> str:
        """docblock"""
        ...

At least according to Pyright 1.1.336, which shows this error if I allow Ruff to remove the ...:

error: Function with declared return type "str" must return value on all code paths
    "None" is incompatible with "str" (reportGeneralTypeIssues)

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions