-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
ctypes stubs incomplete #475
Comments
Couple of others:
|
Fixing the return type of from_buffer()/from_buffer_copy() would require fixing python/mypy#1212; I think I'll use Any for now. This isn't great, but that bug is pretty subtle. Most other things are doable. |
Fixing |
@matthiaskramm @tharvik How bad would it be if I just reverted #454? There's no way I can get our internal usages of ctypes to pass without fixing some tricky mypy issues (see previous comments). Putting |
It is not documented and only available on Windows (which I don't have).
I found a way by using (not pretty, but working) class _MulType(Generic[_T]):
def __call__(self, *args: Any, **kwargs: Any) -> _T: ...
def __mul__(self, size: int) -> _MulType[_T]: ...
c_int = ... # type: _MulType[_SimpleCData[int]] @gvanrossum I guess we can revert it but keep this issue open to have a remainder to do something when mypy is fixed. |
I've deleted the ctypes stub for now. After mypy 0.4.4 has been released (tomorrow?) I'll try to restore the previous version and improve it to the point where our internal code can pass with it. |
There's also the option of annotation |
I think @tharvik's solution can be made to work, I just don't want to do it so close to the 0.4.4 release. |
We have pretty good ctypes stubs now. |
Sadly #454 leaves our code using ctypes a bunch of errors, not all of which are our fault. A few examples:
wintypes.pyi
is empty?!from_buffer_copy()
is optionalc_char*16
is valid to declare a 16-byte bufferThe text was updated successfully, but these errors were encountered: