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

ENH: Add a mypy plugin for inferring the precision of np.ctypeslib.c_intp #19062

Merged
merged 4 commits into from May 28, 2021

Conversation

BvB93
Copy link
Member

@BvB93 BvB93 commented May 21, 2021

Follow up on #19029.

This PR updates numpy's mypy plugin such that it can assign the platform-specific precision of np.ctypeslib.c_intp,
the latter taking one of the following three values: ctypes.c_int, ctypes.c_long or ctypes.c_longlong.

Without the plugin c_intp will default to ctypes.c_int64, which should be the correct type in most cases (i.e. on 64-bit platforms).

Model it after `np.core._internal._getintp_ctype`

Co-Authored-By: Eric Wieser <425260+eric-wieser@users.noreply.github.com>
@charris charris merged commit 336cda1 into numpy:main May 28, 2021
@charris
Copy link
Member

charris commented May 28, 2021

Let's give this a shot. Thanks Bas.

@BvB93 BvB93 deleted the ctypes-plugin branch May 28, 2021 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants