Skip to content

PLE0307 triggers on __str__ that always raises an exception #11016

@ThiefMaster

Description

@ThiefMaster
class PasswordHash:
    def __str__(self):
        raise RuntimeError('This hash cannot be used in a string context')
$ ruff check --isolated --select PLE0307 --preview --no-cache --output-format concise rufftest/ruff_sample.py
rufftest/ruff_sample.py:2:9: PLE0307 `__str__` does not return `str`

It works as expected when raising NotImplementedError, but IMHO any raise-only body should avoid triggering this.

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