8000 Check ufunc's dict on creation · numpy/numpy@ccdeffb · GitHub
[go: up one dir, main page]

Skip to content
8000

Commit ccdeffb

Browse files
committed
Check ufunc's dict on creation
1 parent 058ea0f commit ccdeffb

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

numpy/_core/src/umath/ufunc_object.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4772,6 +4772,10 @@ PyUFunc_FromFuncAndDataAndSignatureAndIdentity(PyUFuncGenericFunction *func, voi
47724772
}
47734773
}
47744774
ufunc->dict = PyDict_New();
4775+
if (ufunc->dict == NULL) {
4776+
Py_DECREF(ufunc);
4777+
return NULL;
4778+
}
47754779
/*
47764780
* TODO: I tried adding a default promoter here (either all object for
47774781
* some special cases, or all homogeneous). Those are reasonable
@@ -5199,7 +5203,7 @@ ufunc_traverse(PyUFuncObject *self, visitproc visit, void *arg)
51995203
if (self->identity == PyUFunc_IdentityValue) {
52005204
Py_VISIT(self->identity_value);
52015205
}
5202-
Py_VISIT(self->dict);
5206+
//Py_VISIT(self->dict);
52035207
return 0;
52045208
}
52055209

0 commit comments

Comments
 (0)
0