Skip to content

Commit ff238ae

Browse files
committed
Fix error handling in casts
1 parent f1b2489 commit ff238ae

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

stringdtype/stringdtype/src/casts.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ string_to_string(PyArrayMethod_Context *NPY_UNUSED(context),
5555
while (N--) {
5656
load_string(in, &s);
5757
os = (ss *)out;
58-
if (ssdup(s, os) == -1) {
58+
if (ssdup(s, os) < 0) {
5959
gil_error(PyExc_MemoryError, "ssdup failed");
6060
return -1;
6161
}
@@ -218,7 +218,7 @@ unicode_to_string(PyArrayMethod_Context *context, char *const data[],
218218
return -1;
219219
}
220220
ss *out_ss = (ss *)out;
221-
if (ssnewemptylen(out_num_bytes, out_ss) == -1) {
221+
if (ssnewemptylen(out_num_bytes, out_ss) < 0) {
222222
gil_error(PyExc_MemoryError, "ssnewemptylen failed");
223223
return -1;
224224
}

0 commit comments

Comments
 (0)