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

Missing 'has no attribute' #4926

Closed
ghost opened this issue Apr 18, 2018 · 3 comments
Closed

Missing 'has no attribute' #4926

ghost opened this issue Apr 18, 2018 · 3 comments

Comments

@ghost
Copy link

ghost commented Apr 18, 2018

Code:

from ctypes import c_voidp

Mypy runing as:

mypy --strict --ignore-missing-imports --follow-imports=silent

It reports:

Module 'ctypes' has no attribute 'c_voidp'

But 'c_voidp' in dir(ctypes) return True.

@JelleZijlstra
Copy link
Member

JelleZijlstra commented Apr 18, 2018

This is an issue with http://github.com/python/typeshed. It looks like we misspelled c_voidp as c_void_p: https://github.com/python/typeshed/blob/master/stdlib/2and3/ctypes/__init__.pyi#L216. This should be easy to fix; would you want to submit a pull request?

Edit: Actually it is not misspelled; ctypes just exposes the same object under both names.

@ghost
Copy link
Author

ghost commented Apr 19, 2018

Yes, c_void_p works. OK.

@JelleZijlstra
Copy link
Member

OK, since c_voidp is undocumented I don't think it's worth doing more here. If you want to use the _-less variant, you can send a PR to typeshed though.

onyx-and-iris added a commit to onyx-and-iris/voicemeeter-api-python that referenced this issue Jun 29, 2024
fixes mypy 'has no attribute'

see python/mypy#4926
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant