summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--numpy/core/src/multiarray/experimental_public_dtype_api.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/numpy/core/src/multiarray/experimental_public_dtype_api.c b/numpy/core/src/multiarray/experimental_public_dtype_api.c
index f4133fd80..79261a9a7 100644
--- a/numpy/core/src/multiarray/experimental_public_dtype_api.c
+++ b/numpy/core/src/multiarray/experimental_public_dtype_api.c
@@ -209,6 +209,12 @@ PyArrayInitDTypeMeta_FromSpec(
return -1;
}
+ if (NPY_DT_SLOTS(DType)->ensure_canonical == NULL) {
+ PyErr_SetString(PyExc_RuntimeError,
+ "A DType must provide an ensure_canonical implementation.");
+ return -1;
+ }
+
/*
* Now that the spec is read we can check that all required functions were
* defined by the user.