summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2021-06-22 23:14:37 +0300
committerGitHub <noreply@github.com>2021-06-22 23:14:37 +0300
commit001c1ca1c507ca18aa22742a5ca0b426a3b877e2 (patch)
tree8b3550c2bd694cee4dbb710fc37b4044e3f9850a
parent6d4b2a7d4f6f149846c054f1c62e3357062eddbb (diff)
parenta525954b7e1f6bb8237e7d491a9c1d50837eeac7 (diff)
downloadnumpy-001c1ca1c507ca18aa22742a5ca0b426a3b877e2.tar.gz
Merge pull request #19298 from BvB93/c_intp_docs
DOC: Add documentation for `np.ctypeslib.c_intp`
-rw-r--r--doc/source/conf.py5
-rw-r--r--doc/source/reference/routines.ctypeslib.rst7
-rw-r--r--numpy/core/_internal.py9
3 files changed, 16 insertions, 5 deletions
diff --git a/doc/source/conf.py b/doc/source/conf.py
index a49074922..59e1e9b8d 100644
--- a/doc/source/conf.py
+++ b/doc/source/conf.py
@@ -435,6 +435,11 @@ def linkcode_resolve(domain, info):
if not fn:
return None
+ # Ignore re-exports as their source files are not within the numpy repo
+ module = inspect.getmodule(obj)
+ if module is not None and not module.__name__.startswith("numpy"):
+ return None
+
try:
source, lineno = inspect.getsourcelines(obj)
except Exception:
diff --git a/doc/source/reference/routines.ctypeslib.rst b/doc/source/reference/routines.ctypeslib.rst
index 3a059f5d9..c6127ca64 100644
--- a/doc/source/reference/routines.ctypeslib.rst
+++ b/doc/source/reference/routines.ctypeslib.rst
@@ -11,3 +11,10 @@ C-Types Foreign Function Interface (:mod:`numpy.ctypeslib`)
.. autofunction:: as_ctypes_type
.. autofunction:: load_library
.. autofunction:: ndpointer
+
+.. class:: c_intp
+
+ A `ctypes` signed integer type of the same size as `numpy.intp`.
+
+ Depending on the platform, it can be an alias for either `~ctypes.c_int`,
+ `~ctypes.c_long` or `~ctypes.c_longlong`.
diff --git a/numpy/core/_internal.py b/numpy/core/_internal.py
index 3b0c46467..3ed22818f 100644
--- a/numpy/core/_internal.py
+++ b/numpy/core/_internal.py
@@ -324,10 +324,10 @@ class _ctypes:
"""
(c_intp*self.ndim): A ctypes array of length self.ndim where
the basetype is the C-integer corresponding to ``dtype('p')`` on this
- platform. This base-type could be `ctypes.c_int`, `ctypes.c_long`, or
- `ctypes.c_longlong` depending on the platform.
- The c_intp type is defined accordingly in `numpy.ctypeslib`.
- The ctypes array contains the shape of the underlying array.
+ platform (see `~numpy.ctypeslib.c_intp`). This base-type could be
+ `ctypes.c_int`, `ctypes.c_long`, or `ctypes.c_longlong` depending on
+ the platform. The ctypes array contains the shape of
+ the underlying array.
"""
return self.shape_as(_getintp_ctype())
@@ -907,4 +907,3 @@ class recursive:
self.func = func
def __call__(self, *args, **kwargs):
return self.func(self, *args, **kwargs)
-