Skip to content

Commit 6a296c4

Browse files
committed
BUG: remove questionable static initialization of an array object
1 parent 90b1f38 commit 6a296c4

File tree

1 file changed

+6
-13
lines changed

1 file changed

+6
-13
lines changed

numpy/_core/src/umath/ufunc_object.c

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -698,16 +698,13 @@ convert_ufunc_arguments(PyUFuncObject *ufunc,
698698
* TODO: Just like the general dual NEP 50/legacy promotion
699699
* support this is meant as a temporary hack for NumPy 1.25.
700700
*/
701-
static PyArrayObject *zero_arr = NULL;
702-
if (NPY_UNLIKELY(zero_arr == NULL)) {
703-
zero_arr = (PyArrayObject *)PyArray_ZEROS(
704-
0, NULL, NPY_LONG, NPY_FALSE);
705-
if (zero_arr == NULL) {
706-
goto fail;
707-
}
708-
((PyArrayObject_fields *)zero_arr)->flags |= (
709-
NPY_ARRAY_WAS_PYTHON_INT|NPY_ARRAY_WAS_INT_AND_REPLACED);
701+
PyArrayObject *zero_arr = (PyArrayObject *)PyArray_ZEROS(
702+
0, NULL, NPY_LONG, NPY_FALSE);
703+
if (zero_arr == NULL) {
704+
goto fail;
710705
}
706+
((PyArrayObject_fields *)zero_arr)->flags |= (
707+
NPY_ARRAY_WAS_PYTHON_INT|NPY_ARRAY_WAS_INT_AND_REPLACED);
711708
Py_INCREF(zero_arr);
712709
Py_SETREF(out_op[i], zero_arr);
713710
}
@@ -6530,10 +6527,6 @@ ufunc_get_signature(PyUFuncObject *ufunc, void *NPY_UNUSED(ignored))
65306527

65316528
#undef _typecharfromnum
65326529

6533-
/*
6534-
* Docstring is now set from python
6535-
* static char *Ufunctype__doc__ = NULL;
6536-
*/
65376530
static PyGetSetDef ufunc_getset[] = {
65386531
{"__doc__",
65396532
(getter)ufunc_get_doc,

0 commit comments

Comments
 (0)