diff options
| -rw-r--r-- | numpy/core/src/multiarray/multiarraymodule.c | 36 | ||||
| -rw-r--r-- | numpy/core/src/umath/umathmodule.c | 15 |
2 files changed, 40 insertions, 11 deletions
diff --git a/numpy/core/src/multiarray/multiarraymodule.c b/numpy/core/src/multiarray/multiarraymodule.c index b1d0fe756..b8ab52340 100644 --- a/numpy/core/src/multiarray/multiarraymodule.c +++ b/numpy/core/src/multiarray/multiarraymodule.c @@ -4617,14 +4617,34 @@ NPY_VISIBILITY_HIDDEN PyObject * npy_ma_str_numpy = NULL; static int intern_strings(void) { - if (!(npy_ma_str_array_wrap = PyUnicode_InternFromString("__array_wrap__"))) return -1; - if (!(npy_ma_str_array_finalize = PyUnicode_InternFromString("__array_finalize__"))) return -1; - if (!(npy_ma_str_implementation = PyUnicode_InternFromString("_implementation"))) return -1; - if (!(npy_ma_str_axis1 = PyUnicode_InternFromString("axis1"))) return -1; - if (!(npy_ma_str_axis2 = PyUnicode_InternFromString("axis2"))) return -1; - if (!(npy_ma_str_like = PyUnicode_InternFromString("like"))) return -1; - if (!(npy_ma_str_numpy = PyUnicode_InternFromString("numpy"))) return -1; - + npy_ma_str_array_wrap = PyUnicode_InternFromString("__array_wrap__"); + if (npy_ma_str_array_wrap == NULL) { + return -1; + } + npy_ma_str_array_finalize = PyUnicode_InternFromString("__array_finalize__"); + if (npy_ma_str_array_finalize == NULL) { + return -1; + } + npy_ma_str_implementation = PyUnicode_InternFromString("_implementation"); + if (npy_ma_str_implementation == NULL) { + return -1; + } + npy_ma_str_axis1 = PyUnicode_InternFromString("axis1"); + if (npy_ma_str_axis1 == NULL) { + return -1; + } + npy_ma_str_axis2 = PyUnicode_InternFromString("axis2"); + if (npy_ma_str_axis2 == NULL) { + return -1; + } + npy_ma_str_like = PyUnicode_InternFromString("like"); + if (npy_ma_str_like == NULL) { + return -1; + } + npy_ma_str_numpy = PyUnicode_InternFromString("numpy"); + if (npy_ma_str_numpy == NULL) { + return -1; + } return 0; } diff --git a/numpy/core/src/umath/umathmodule.c b/numpy/core/src/umath/umathmodule.c index b4b7db760..6a718889b 100644 --- a/numpy/core/src/umath/umathmodule.c +++ b/numpy/core/src/umath/umathmodule.c @@ -224,9 +224,18 @@ NPY_VISIBILITY_HIDDEN PyObject *npy_um_str_pyvals_name = NULL; static int intern_strings(void) { - if (!(npy_um_str_array_prepare = PyUnicode_InternFromString("__array_prepare__"))) return -1; - if (!(npy_um_str_array_wrap = PyUnicode_InternFromString("__array_wrap__"))) return -1; - if (!(npy_um_str_pyvals_name = PyUnicode_InternFromString(UFUNC_PYVALS_NAME))) return -1; + npy_um_str_array_prepare = PyUnicode_InternFromString("__array_prepare__"); + if (npy_um_str_array_prepare == NULL) { + return -1; + } + npy_um_str_array_wrap = PyUnicode_InternFromString("__array_wrap__"); + if (npy_um_str_array_wrap == NULL) { + return -1; + } + npy_um_str_pyvals_name = PyUnicode_InternFromString(UFUNC_PYVALS_NAME); + if (npy_um_str_pyvals_name == NULL) { + return -1; + } return 0; } |
