diff options
author | Joseph Fox-Rabinovitz <madphysicist@users.noreply.github.com> | 2022-01-06 15:23:29 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-06 14:23:29 -0600 |
commit | 44b9cdb17c074daa0e5d747f02c45a49ad6d786a (patch) | |
tree | 345a43932067a1bc36e26f3cb5fea57f809f8141 /numpy | |
parent | 1684a933d6e4efa260434fd13b67a8ef34db7eca (diff) | |
download | numpy-44b9cdb17c074daa0e5d747f02c45a49ad6d786a.tar.gz |
BUG: Added check for NULL data in ufuncs (#20689)
* BUG: Added check for NULL data in ufuncs
* DOC: Made NULL refs more explicit
* DOC: Added ..versionchanged:: tag
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/core/src/umath/ufunc_type_resolution.c | 2 | ||||
-rw-r--r-- | numpy/core/src/umath/umathmodule.c | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/numpy/core/src/umath/ufunc_type_resolution.c b/numpy/core/src/umath/ufunc_type_resolution.c index 9ed923cf5..90846ca55 100644 --- a/numpy/core/src/umath/ufunc_type_resolution.c +++ b/numpy/core/src/umath/ufunc_type_resolution.c @@ -1528,7 +1528,7 @@ PyUFunc_DefaultLegacyInnerLoopSelector(PyUFuncObject *ufunc, } if (j == nargs) { *out_innerloop = ufunc->functions[i]; - *out_innerloopdata = ufunc->data[i]; + *out_innerloopdata = (ufunc->data == NULL) ? NULL : ufunc->data[i]; return 0; } diff --git a/numpy/core/src/umath/umathmodule.c b/numpy/core/src/umath/umathmodule.c index f8d010ee0..d79506000 100644 --- a/numpy/core/src/umath/umathmodule.c +++ b/numpy/core/src/umath/umathmodule.c @@ -56,7 +56,7 @@ object_ufunc_loop_selector(PyUFuncObject *ufunc, int *out_needs_api) { *out_innerloop = ufunc->functions[0]; - *out_innerloopdata = ufunc->data[0]; + *out_innerloopdata = (ufunc->data == NULL) ? NULL : ufunc->data[0]; *out_needs_api = 1; return 0; |