summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSebastian Berg <sebastianb@nvidia.com>2023-03-01 23:07:00 +0100
committerGitHub <noreply@github.com>2023-03-01 23:07:00 +0100
commite82af03181c2733290c6cabe54d739d8953860aa (patch)
tree02190bcf53511b0742d6613a5d2141af81f81460
parent486878b37fc7439a3b2b87747f50db9b62fea8eb (diff)
parent9279653bef78247eb50b371d4d96001ffe363ba2 (diff)
downloadnumpy-e82af03181c2733290c6cabe54d739d8953860aa.tar.gz
Merge pull request #23306 from ngoldbaum/allow-is-numeric
MAINT: allow NPY_DT_NUMERIC flag on user dtypes
-rw-r--r--numpy/core/src/multiarray/experimental_public_dtype_api.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/numpy/core/src/multiarray/experimental_public_dtype_api.c b/numpy/core/src/multiarray/experimental_public_dtype_api.c
index 70a6f1995..c0da0a7b7 100644
--- a/numpy/core/src/multiarray/experimental_public_dtype_api.c
+++ b/numpy/core/src/multiarray/experimental_public_dtype_api.c
@@ -138,10 +138,12 @@ PyArrayInitDTypeMeta_FromSpec(
}
/* Check and handle flags: */
- if (spec->flags & ~(NPY_DT_PARAMETRIC|NPY_DT_ABSTRACT)) {
+ int allowed_flags = NPY_DT_PARAMETRIC | NPY_DT_ABSTRACT | NPY_DT_NUMERIC;
+ if (spec->flags & ~(allowed_flags)) {
PyErr_SetString(PyExc_RuntimeError,
- "invalid DType flags specified, only parametric and abstract "
- "are valid flags for user DTypes.");
+ "invalid DType flags specified, only NPY_DT_PARAMETRIC, "
+ "NPY_DT_ABSTRACT, and NPY_DT_NUMERIC are valid flags for "
+ "user DTypes.");
return -1;
}