Skip to content

EM101 false positive #19596

@aspizu

Description

@aspizu

Summary

https://play.ruff.rs/a6f026e4-bf4e-487f-89f2-dbfb25d991ac

import typing

raise typing.cast("Exception", None)

The fix for EM101 is applied.

which becomes:

import typing

msg = "Exception"
raise typing.cast(msg, None)

then the fix for TC006 is applied.

which becomes:

import typing

msg = "Exception"
raise typing.cast("msg", None)

and it becomes a loop, since that introduces EM101 again.

Version

ruff 0.11.13 (5faf72a 2025-06-05)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingruleImplementing or modifying a lint rule

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions