Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: Fix two errors related to not checking for failed allocations #25425

Merged
merged 1 commit into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions numpy/_core/src/multiarray/mapping.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,11 +936,11 @@ array_boolean_subscript(PyArrayObject *self,
Py_INCREF(dtype);
ret = (PyArrayObject *)PyArray_NewFromDescr(&PyArray_Type, dtype, 1, &size,
NULL, NULL, 0, NULL);
/* not same as *dtype* if the DType class replaces dtypes */
ret_dtype = PyArray_DESCR(ret);
if (ret == NULL) {
return NULL;
}
/* not same as *dtype* if the DType class replaces dtypes */
ret_dtype = PyArray_DESCR(ret);

itemsize = dtype->elsize;
ret_data = PyArray_DATA(ret);
Expand Down
3 changes: 3 additions & 0 deletions numpy/_core/src/multiarray/nditer_constr.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,9 @@ NpyIter_AdvancedNew(int nop, PyArrayObject **op_in, npy_uint32 flags,
/* Allocate memory for the iterator */
iter = (NpyIter*)
PyObject_Malloc(NIT_SIZEOF_ITERATOR(itflags, ndim, nop));
if (iter == NULL) {
return NULL;
}

NPY_IT_TIME_POINT(c_malloc);

Expand Down