mypy icon indicating copy to clipboard operation
mypy copied to clipboard

Literal of type string not accepted as keyword name

Open twoertwein opened this issue 2 years ago • 0 comments

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

twoertwein avatar Sep 17 '22 17:09 twoertwein