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

ClassVar not respected when indirectly imported #4965

Closed
patrick-kidger opened this issue Apr 18, 2023 · 1 comment
Closed

ClassVar not respected when indirectly imported #4965

patrick-kidger opened this issue Apr 18, 2023 · 1 comment
Labels
as designed Not a bug, working as intended

Comments

@patrick-kidger
Copy link

# tmp.py
from typing import ClassVar as CV

# tmp2.py
from tmp import CV
from dataclasses import dataclass

@dataclass
class X:
    x: CV[bool]

X()  # Argument missing for parameter "x"

Expected behaviour is no error message.

Python 3.8.16, Pyright version 1.1.302 run from the command line.

Related to #3025, I think. It sounds like this is probably a wontfix, so I'm really just opening this bug in response to the "if it comes up frequently enough" message of the previous issue.

@erictraut
Copy link
Collaborator

Yeah, your assumptions are correct — both in that this is related to to #3025 and that it's a "won't fix". This is something that pyright needs to know about when it's building symbol tables, and that's done long before type evaluation is possible.

@erictraut erictraut added the as designed Not a bug, working as intended label Apr 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
as designed Not a bug, working as intended
Projects
None yet
Development

No branches or pull requests

2 participants