Issue #22156: Fix some "comparison between signed and unsigned integers"
compiler warnings in the Modules/ subdirectory.
diff --git a/Modules/_io/bytesio.c b/Modules/_io/bytesio.c
index d07da08..56ad788 100644
--- a/Modules/_io/bytesio.c
+++ b/Modules/_io/bytesio.c
@@ -53,10 +53,12 @@
         Py_ssize_t copy_size;
         char *new_buf;
 
-        if((! truncate) && preferred_size < self->string_size) {
+        if((! truncate) && preferred_size < (size_t)self->string_size) {
             preferred_size = self->string_size;
         }
 
+        /* PyMem_Malloc() returns NULL if preferred_size is bigger
+           than PY_SSIZE_T_MAX */
         new_buf = (char *)PyMem_Malloc(preferred_size);
         if (new_buf == NULL) {
             PyErr_NoMemory();
@@ -64,7 +66,7 @@
         }
 
         copy_size = self->string_size;
-        if (copy_size > preferred_size) {
+        if ((size_t)copy_size > preferred_size) {
             copy_size = preferred_size;
         }
 
diff --git a/Modules/_io/textio.c b/Modules/_io/textio.c
index aed5b2d..b4c3c40 100644
--- a/Modules/_io/textio.c
+++ b/Modules/_io/textio.c
@@ -1730,7 +1730,7 @@
     else {
         /* Non-universal mode. */
         Py_ssize_t readnl_len = PyUnicode_GET_LENGTH(readnl);
-        char *nl = PyUnicode_DATA(readnl);
+        Py_UCS1 *nl = PyUnicode_1BYTE_DATA(readnl);
         /* Assume that readnl is an ASCII character. */
         assert(PyUnicode_KIND(readnl) == PyUnicode_1BYTE_KIND);
         if (readnl_len == 1) {