Skip to content

Commit

Permalink
MNT: apply review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
ngoldbaum authored and charris committed May 10, 2024
1 parent 16c292d commit 0a07582
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion numpy/_core/src/umath/stringdtype_ufuncs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,7 @@ string_lrstrip_chars_strided_loop(
if (NpyString_pack(oallocator, ops, new_buf, new_buf_size) < 0) {
npy_gil_error(PyExc_MemoryError, "Failed to pack string in %s",
ufunc_name);
PyMem_RawFree(new_buf);
goto fail;
}

Expand Down Expand Up @@ -1189,7 +1190,6 @@ string_lrstrip_whitespace_strided_loop(
npy_static_string s = {0, NULL};
int s_isnull = NpyString_load(allocator, ps, &s);


if (s_isnull == -1) {
npy_gil_error(PyExc_MemoryError, "Failed to load string in %s",
ufunc_name);
Expand Down
3 changes: 1 addition & 2 deletions numpy/_core/tests/test_stringdtype.py
Original file line number Diff line number Diff line change
Expand Up @@ -1503,8 +1503,7 @@ def test_setup(self):
view = self.get_view(self.a)
sizes = np.where(is_short, view['size_and_flags'] & 0xf,
view['size'])
assert_array_equal(sizes, np.strings
.str_len(self.a))
assert_array_equal(sizes, np.strings.str_len(self.a))
assert_array_equal(view['xsiz'][2:],
np.void(b'\x00' * (self.sizeofstr // 4 - 1)))
# Check that the medium string uses only 1 byte for its length
Expand Down

0 comments on commit 0a07582

Please sign in to comment.