Skip to content

Literal of type string not accepted as keyword name #13674

Open
@twoertwein

Description

@twoertwein

To Reproduce

from typing import Literal

def fun(**kwargs) -> None:
    ...

class A:
    def __init__(self):
        self.a: Literal["a"] = "a"

    def test(self) -> None:
        return fun(**{self.a: "a"})  #  error: Keywords must be strings  [misc]

Your Environment

  • Mypy version used: 0.971

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions