Skip to content

BUG: Fix small valgrind-found issues #18651

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

Merged
merged 3 commits into from
Mar 20, 2021
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions numpy/core/src/multiarray/array_coercion.c
Original file line number Diff line number Diff line change
Expand Up @@ -748,6 +748,7 @@ find_descriptor_from_array(
NULL, DType, &flags, item_DType) < 0) {
Py_DECREF(iter);
Py_DECREF(elem);
Py_XDECREF(*out_descr);
Py_XDECREF(item_DType);
return -1;
}
Expand Down
1 change: 1 addition & 0 deletions numpy/core/src/multiarray/buffer.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,7 @@ void_getbuffer(PyObject *self, Py_buffer *view, int flags)
*/
_buffer_info_t *info = _buffer_get_info(&scalar->_buffer_info, self, flags);
if (info == NULL) {
Py_DECREF(self);
return -1;
}
view->format = info->format;
Expand Down
2 changes: 2 additions & 0 deletions numpy/core/src/multiarray/legacy_dtype_implementation.c
Original file line number Diff line number Diff line change
Expand Up @@ -161,10 +161,12 @@ PyArray_LegacyCanCastSafely(int fromtype, int totype)

while (*curtype != NPY_NOTYPE) {
if (*curtype++ == totype) {
Py_DECREF(from);
return 1;
}
}
}
Py_DECREF(from);
return 0;
}

Expand Down
1 change: 1 addition & 0 deletions numpy/core/src/umath/_umath_tests.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -614,6 +614,7 @@ UMath_Tests_test_dispatch(PyObject *NPY_UNUSED(dummy), PyObject *NPY_UNUSED(dumm
if (item == NULL || PyDict_SetItemString(dict, "@str@", item) < 0) {
goto err;
}
Py_DECREF(item);
/**end repeat**/
item = PyList_New(0);
if (item == NULL || PyDict_SetItemString(dict, "all", item) < 0) {
Expand Down
2 changes: 1 addition & 1 deletion numpy/core/tests/test_multiarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -7486,7 +7486,7 @@ def test_out_of_order_fields(self):
memoryview(arr)

def test_max_dims(self):
a = np.empty((1,) * 32)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was there a problem with empty? I agree ones is nicer.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its a harmless "use of uninitialized memory" in valgrind because check_roundtrip actually does something with the values (or at least it looks like it).

a = np.ones((1,) * 32)
self._check_roundtrip(a)

@pytest.mark.slow
Expand Down