summaryrefslogtreecommitdiff
path: root/numpy/core/include
diff options
context:
space:
mode:
authorSebastian Berg <sebastian@sipsolutions.net>2020-05-08 19:47:12 -0500
committerSebastian Berg <sebastian@sipsolutions.net>2020-07-08 18:13:06 -0500
commitcec10fbb8ec407258ce431c6d6bd64c430191f10 (patch)
tree5712846624670b82458475ed67bf1c007254160e /numpy/core/include
parent302813c9325a63870d204551ca7e61957bc16662 (diff)
downloadnumpy-cec10fbb8ec407258ce431c6d6bd64c430191f10.tar.gz
Fixup for scalar kind, and ensure OBJECT is special for assignment
Diffstat (limited to 'numpy/core/include')
-rw-r--r--numpy/core/include/numpy/ndarraytypes.h12
1 files changed, 9 insertions, 3 deletions
diff --git a/numpy/core/include/numpy/ndarraytypes.h b/numpy/core/include/numpy/ndarraytypes.h
index ab8ffaa84..0eeaed599 100644
--- a/numpy/core/include/numpy/ndarraytypes.h
+++ b/numpy/core/include/numpy/ndarraytypes.h
@@ -1822,8 +1822,14 @@ typedef void (PyDataMem_EventHookFunc)(void *inp, void *outp, size_t size,
typedef PyArray_Descr *(discover_descr_from_pyobject_function)(
PyArray_DTypeMeta *cls, PyObject *obj);
- typedef int (is_known_scalar_function)(
- PyArray_DTypeMeta *cls, PyObject *obj);
+ /*
+ * Before making this public, we should decide whether it should pass
+ * the type, or allow looking at the object. A possible use-case:
+ * `np.array(np.array([0]), dtype=np.ndarray)`
+ * Could consider arrays that are not `dtype=ndarray` "scalars".
+ */
+ typedef int (is_known_scalar_type_function)(
+ PyArray_DTypeMeta *cls, PyTypeObject *obj);
typedef PyArray_Descr *(default_descr_function)(PyArray_DTypeMeta *cls);
@@ -1879,7 +1885,7 @@ typedef void (PyDataMem_EventHookFunc)(void *inp, void *outp, size_t size,
/* DType methods, these could be moved into its own struct */
discover_descr_from_pyobject_function *discover_descr_from_pyobject;
- is_known_scalar_function *is_known_scalar;
+ is_known_scalar_type_function *is_known_scalar_type;
default_descr_function *default_descr;
};