Skip to content

RUF013 incorrectly emitted on invalid annotation with bare Optional #13833

@Skylion007

Description

@Skylion007

Here is the bad code diff

-        hsdp_device_mesh: Optional = None,
+        hsdp_device_mesh: Optional[Optional] = None,

Obviously, an untyped Optional is fine, and Optional[Optional] doesn't make much sense here as an autofix.

  • version ruff 0.7.0
  • ruff check RUF013 --select=RUF013 . --fix --unsafe-fixes

Metadata

Metadata

Assignees

No one assigned

    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