Skip to content

Commit e438a86

Browse files
committed
MNT: apply review comments
1 parent dcde9ff commit e438a86

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

numpy/_core/src/umath/stringdtype_ufuncs.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1107,6 +1107,7 @@ string_lrstrip_chars_strided_loop(
11071107
if (NpyString_pack(oallocator, ops, new_buf, new_buf_size) < 0) {
11081108
npy_gil_error(PyExc_MemoryError, "Failed to pack string in %s",
11091109
ufunc_name);
1110+
PyMem_RawFree(new_buf);
11101111
goto fail;
11111112
}
11121113

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

1192-
11931193
if (s_isnull == -1) {
11941194
npy_gil_error(PyExc_MemoryError, "Failed to load string in %s",
11951195
ufunc_name);

numpy/_core/tests/test_stringdtype.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,8 +1492,7 @@ def test_setup(self):
14921492
view = self.get_view(self.a)
14931493
sizes = np.where(is_short, view['size_and_flags'] & 0xf,
14941494
view['size'])
1495-
assert_array_equal(sizes, np.strings
1496-
.str_len(self.a))
1495+
assert_array_equal(sizes, np.strings.str_len(self.a))
14971496
assert_array_equal(view['xsiz'][2:],
14981497
np.void(b'\x00' * (self.sizeofstr // 4 - 1)))
14991498
# Check that the medium string uses only 1 byte for its length

0 commit comments

Comments
 (0)