]> granicus.if.org Git - python/commitdiff
Issue #22156: Fix "comparison between signed and unsigned integers" compiler
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 15 Aug 2014 21:30:40 +0000 (23:30 +0200)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 15 Aug 2014 21:30:40 +0000 (23:30 +0200)
warnings in the Python/ subdirectory.

Python/bltinmodule.c
Python/getargs.c
Python/pythonrun.c
Python/thread.c
Python/traceback.c

index d905ba2d949b96ea133c50ba49d9f9a8047daaa2..d2d169813966ecfce42b1258e296251fea2817c6 100644 (file)
@@ -581,7 +581,7 @@ source_as_string(PyObject *cmd, char *funcname, char *what, PyCompilerFlags *cf)
         return NULL;
     }
 
-    if (strlen(str) != size) {
+    if (strlen(str) != (size_t)size) {
         PyErr_SetString(PyExc_TypeError,
                         "source code string cannot contain null bytes");
         return NULL;
index 946faf2d7e0ac891f3cbdcbbfbfcaa946319ea0a..a31326965868125b8485a776d1ddc5af7798b7f0 100644 (file)
@@ -872,7 +872,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
             STORE_SIZE(count);
             format++;
         } else {
-            if (strlen(*p) != count)
+            if (strlen(*p) != (size_t)count)
                 return converterr(
                     "bytes without null bytes",
                     arg, msgbuf, bufsize);
@@ -994,7 +994,7 @@ convertsimple(PyObject *arg, const char **p_format, va_list *p_va, int flags,
                 *p = PyUnicode_AsUnicodeAndSize(arg, &len);
                 if (*p == NULL)
                     RETURN_ERR_OCCURRED;
-                if (Py_UNICODE_strlen(*p) != len)
+                if (Py_UNICODE_strlen(*p) != (size_t)len)
                     return converterr(
                         "str without null characters or None",
                         arg, msgbuf, bufsize);
index b2d54641910359ff0775c6732a32c5d5014bb130..63d9eeb68962a02c0a7eacbd80b446507429c431 100644 (file)
@@ -1738,7 +1738,7 @@ print_error_text(PyObject *f, int offset, PyObject *text_obj)
         return;
 
     if (offset >= 0) {
-        if (offset > 0 && offset == strlen(text) && text[offset - 1] == '\n')
+        if (offset > 0 && (size_t)offset == strlen(text) && text[offset - 1] == '\n')
             offset--;
         for (;;) {
             nl = strchr(text, '\n');
index d1cb0e6f9d5b174bfb7ebe0d87874ce4943f0dba..9eb5d12f503a03346ad36fa23499b202edf97ac5 100644 (file)
@@ -431,7 +431,7 @@ PyThread_GetInfo(void)
      && defined(_CS_GNU_LIBPTHREAD_VERSION))
     value = NULL;
     len = confstr(_CS_GNU_LIBPTHREAD_VERSION, buffer, sizeof(buffer));
-    if (1 < len && len < sizeof(buffer)) {
+    if (1 < len && (size_t)len < sizeof(buffer)) {
         value = PyUnicode_DecodeFSDefaultAndSize(buffer, len-1);
         if (value == NULL)
             PyErr_Clear();
index 2ece192db90b3d9ea83cf82d47ee08577b4ac591..565094b1e8f91e4007ad281c9be2aff4fb014b01 100644 (file)
@@ -198,7 +198,7 @@ _Py_FindSourceFile(PyObject *filename, char* namebuf, size_t namelen, PyObject *
         }
         strcpy(namebuf, PyBytes_AS_STRING(path));
         Py_DECREF(path);
-        if (strlen(namebuf) != len)
+        if (strlen(namebuf) != (size_t)len)
             continue; /* v contains '\0' */
         if (len > 0 && namebuf[len-1] != SEP)
             namebuf[len++] = SEP;