summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/typing/mypy_plugin.py12
1 files changed, 9 insertions, 3 deletions
diff --git a/numpy/typing/mypy_plugin.py b/numpy/typing/mypy_plugin.py
index 2a5e729f3..db2dc9b2d 100644
--- a/numpy/typing/mypy_plugin.py
+++ b/numpy/typing/mypy_plugin.py
@@ -62,10 +62,16 @@ def _get_extended_precision_list() -> t.List[str]:
def _get_c_intp_name() -> str:
- if np.ctypeslib.c_intp is np.intp:
- return "c_int64" # Plan B, in case `ctypes` fails to import
+ # Adapted from `np.core._internal._getintp_ctype`
+ char = np.dtype('p').char
+ if char == 'i':
+ return "c_int"
+ elif char == 'l':
+ return "c_long"
+ elif char == 'q':
+ return "c_longlong"
else:
- return np.ctypeslib.c_intp.__qualname__
+ return "c_long"
#: A dictionary mapping type-aliases in `numpy.typing._nbit` to