Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 60fb218

Browse filesBrowse files
committed
Check ufunc's dict on creation
1 parent 058ea0f commit 60fb218
Copy full SHA for 60fb218

File tree

1 file changed

+5
-0
lines changed
Filter options

1 file changed

+5
-0
lines changed

‎numpy/_core/src/umath/ufunc_object.c

Copy file name to clipboardExpand all lines: numpy/_core/src/umath/ufunc_object.c
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4687,6 +4687,7 @@ PyUFunc_FromFuncAndDataAndSignatureAndIdentity(PyUFuncGenericFunction *func, voi
46874687
ufunc->core_signature = NULL;
46884688
ufunc->core_enabled = 0;
46894689
ufunc->obj = NULL;
4690+
ufunc->dict = NULL;
46904691
ufunc->core_num_dims = NULL;
46914692
ufunc->core_num_dim_ix = 0;
46924693
ufunc->core_offsets = NULL;
@@ -4772,6 +4773,10 @@ PyUFunc_FromFuncAndDataAndSignatureAndIdentity(PyUFuncGenericFunction *func, voi
47724773
}
47734774
}
47744775
ufunc->dict = PyDict_New();
4776+
if (ufunc->dict == NULL) {
4777+
Py_DECREF(ufunc);
4778+
return NULL;
4779+
}
47754780
/*
47764781
* TODO: I tried adding a default promoter here (either all object for
47774782
* some special cases, or all homogeneous). Those are reasonable

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.