Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Vulcagon opened this issue Apr 1, 2024 · 3 comments
Closed
Labels
triage-needed Issue is not triaged.

Comments

@Vulcagon
Copy link

Vulcagon commented Apr 1, 2024

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

@github-actions github-actions bot added the triage-needed Issue is not triaged. label Apr 1, 2024
@Vulcagon Vulcagon changed the title [Bug] Error [E1101:no-member](https://pylint.readthedocs.io/en/latest/user_guide/messages/error/no-member.html) when accessing __annotations__ on TypedDict classes [Bug] Error E1101 when accessing __annotations__ on TypedDict classes Apr 1, 2024
@karthiknadig
Copy link
Member

@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

@karthiknadig karthiknadig closed this as not planned Won't fix, can't repro, duplicate, stale Apr 1, 2024
@Vulcagon
Copy link
Author

Vulcagon commented Apr 2, 2024

@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
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage-needed Issue is not triaged.
Projects
None yet
Development

No branches or pull requests

2 participants