ENH: Add a mypy plugin for inferring the precision of np.ctypeslib.c_intp#19062
Merged
charris merged 4 commits intonumpy:mainfrom May 28, 2021
Merged
ENH: Add a mypy plugin for inferring the precision of np.ctypeslib.c_intp#19062charris merged 4 commits intonumpy:mainfrom
np.ctypeslib.c_intp#19062charris merged 4 commits intonumpy:mainfrom
Conversation
charris
reviewed
May 25, 2021
eric-wieser
reviewed
May 25, 2021
Model it after `np.core._internal._getintp_ctype` Co-Authored-By: Eric Wieser <425260+eric-wieser@users.noreply.github.com>
Member
|
Let's give this a shot. Thanks Bas. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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_longorctypes.c_longlong.Without the plugin
c_intpwill default toctypes.c_int64, which should be the correct type in most cases (i.e. on 64-bit platforms).