-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
ctypes/__init__.pyi uses TypeVar within ClassVar #6333
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
Comments
At runtime Reference: https://github.com/python/cpython/blob/main/Modules/_ctypes/callproc.c#L1947. The POINTER function right above it is the one that creates the type. |
The class Array(Generic[_CT], _CData):
_type_: ClassVar[Type[_CT]]
...
`` |
I can make a PR to mypy to forbid this pattern (python/mypy#11538). Looks like we would need to fix typeshed first. |
Mypy PR: python/mypy#11585 |
I just implemented a check in pyright to report an error if a TypeVar is used within a ClassVar declaration. PEP 526 specifically says:
A similar feature request was recently filed in the mypy issue tracker.
Here's the issue in the pyright issue tracker: microsoft/pyright#2567.
This check is highlighting a problem in the
pointer
class defined within thectypes/__init__.pyi
stub.I don't know enough about ctypes to suggest a proper fix.
The text was updated successfully, but these errors were encountered: