summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorSebastian Berg <sebastianb@nvidia.com>2023-01-25 12:54:31 +0100
committerSebastian Berg <sebastianb@nvidia.com>2023-01-29 22:56:30 +0100
commitfa5d1af7bb0842e62a8c5625212d2c7721816d78 (patch)
tree6bdc7927511cd0c360527d21f4657728868e638f /numpy
parent86f2e1a98372336523974d6e20ee286d912d7a33 (diff)
downloadnumpy-fa5d1af7bb0842e62a8c5625212d2c7721816d78.tar.gz
BUG: Fix crash when using complex double scalars with NEP 50
Not adding a test since there is already a test that crashes due to this, it just isn't used with weak promotion and right now I am hoping I may be able to make the test suite runnable enabling it.
Diffstat (limited to 'numpy')
-rw-r--r--numpy/core/src/multiarray/abstractdtypes.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/numpy/core/src/multiarray/abstractdtypes.h b/numpy/core/src/multiarray/abstractdtypes.h
index b0850bd35..a3f6ceb05 100644
--- a/numpy/core/src/multiarray/abstractdtypes.h
+++ b/numpy/core/src/multiarray/abstractdtypes.h
@@ -58,7 +58,8 @@ npy_mark_tmp_array_if_pyscalar(
}
return 1;
}
- else if (PyComplex_Check(obj) && PyArray_TYPE(arr) == NPY_CDOUBLE) {
+ else if (PyComplex_Check(obj) && !PyArray_IsScalar(obj, CDouble)
+ && PyArray_TYPE(arr) == NPY_CDOUBLE) {
((PyArrayObject_fields *)arr)->flags |= NPY_ARRAY_WAS_PYTHON_COMPLEX;
if (dtype != NULL) {
Py_INCREF(&PyArray_PyComplexAbstractDType);