Use safer comparisons (only matters when sizeof(int) != sizeof(size_t)). fread
and fwrite return size_t, so it is safer to cast up to the largest type for the
comparison. I believe the cast is required at all to remove compiler warnings.
diff --git a/Modules/arraymodule.c b/Modules/arraymodule.c
index ec1b08d..6648c9c 100644
--- a/Modules/arraymodule.c
+++ b/Modules/arraymodule.c
@@ -1039,8 +1039,8 @@
return NULL;
}
if (self->ob_size > 0) {
- if ((int)fwrite(self->ob_item, self->ob_descr->itemsize,
- self->ob_size, fp) != self->ob_size) {
+ if (fwrite(self->ob_item, self->ob_descr->itemsize,
+ self->ob_size, fp) != (size_t)self->ob_size) {
PyErr_SetFromErrno(PyExc_IOError);
clearerr(fp);
return NULL;