microsoft / vscode-pylint

Linting support for python using the pylint library.
https://marketplace.visualstudio.com/items?itemName=ms-python.pylint
MIT License
70 stars 34 forks source link

[Bug] Error E1101 when accessing `__annotations__` on `TypedDict` classes #539

Closed Vulcagon closed 5 months ago

Vulcagon commented 5 months ago

When accessing the __annotations__ attribute on a TypedDict Pyint gives the error

Instance of TypedDict has no __annotations__ member E1101:no-member

This only happens when defining a TypedDict like MyTypedDict = TypedDict(...)

from typing import TypedDict

class MyTypedDict(TypedDict):
    a: int
    b: str

OtherTypedDict = TypedDict('OtherTypedDict', {'a': int, 'b': str})

print(MyTypedDict.__annotations__)  # No Error
print(OtherTypedDict.__annotations__)  # Error

I'm using Pylint as VS Code extension

Python version: 3.12.2 VS Code version: 1.87.2 (Windows 11) Python extension version: 2024.2.1 Pylint extension version: 2023.10.1

karthiknadig commented 5 months ago

@Vulcagon This should be filed on the pylint repo: https://github.com/pylint-dev/pylint/issues

I can repo this from command line. This extension is just a wrapper around pylint making it easier to run and see the results from pylint. image

Vulcagon commented 5 months ago

@karthiknadig Oh thank you. I found out that this issue has already been reported here

Quick question: Where do I report issues where you're code is colorized incorrectly? On the vscode-python repo?

eg

print(f"[{
    my_var
}]")
 ^ ^
karthiknadig commented 5 months ago

Try https://github.com/microsoft/pylance-release/issues