Skip to content

Commit d720d9a

Browse files
committed
Properly flatten call to PyUnicode_AsWideChar
1 parent bae3c5b commit d720d9a

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

Modules/_ctypes/_ctypes.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1552,12 +1552,9 @@ WCharArray_set_value(CDataObject *self, PyObject *value, void *Py_UNUSED(ignored
15521552
return -1;
15531553
}
15541554
LOCK_PTR(self);
1555-
if (PyUnicode_AsWideChar(value, (wchar_t *)self->b_ptr, size) < 0) {
1556-
UNLOCK_PTR(self);
1557-
return -1;
1558-
}
1555+
int rc = PyUnicode_AsWideChar(value, (wchar_t *)self->b_ptr, size);
15591556
UNLOCK_PTR(self);
1560-
return 0;
1557+
return rc < 0 ? -1 : 0;
15611558
}
15621559

15631560
static PyGetSetDef WCharArray_getsets[] = {

0 commit comments

Comments
 (0)