]> granicus.if.org Git - python/commitdiff
Fix unused variable and signed/unsigned warnings (GH-15537)
authorRaymond Hettinger <rhettinger@users.noreply.github.com>
Tue, 27 Aug 2019 16:55:13 +0000 (09:55 -0700)
committerGitHub <noreply@github.com>
Tue, 27 Aug 2019 16:55:13 +0000 (09:55 -0700)
Objects/unicodeobject.c
Python/peephole.c
Python/pystrhex.c

index aa933773233b587c12a0609495365165c6bc94fb..d4b2c93a8452643ac0055d43e8eec22794e6bcc4 100644 (file)
@@ -500,10 +500,14 @@ _PyUnicode_CheckConsistency(PyObject *op, int check_content)
     }
     else {
         PyCompactUnicodeObject *compact = (PyCompactUnicodeObject *)op;
+#ifndef NDEBUG
         void *data;
+#endif
 
         if (ascii->state.compact == 1) {
+#ifndef NDEBUG
             data = compact + 1;
+#endif
             _PyObject_ASSERT(op, kind == PyUnicode_1BYTE_KIND
                                  || kind == PyUnicode_2BYTE_KIND
                                  || kind == PyUnicode_4BYTE_KIND);
@@ -512,9 +516,11 @@ _PyUnicode_CheckConsistency(PyObject *op, int check_content)
             _PyObject_ASSERT(op, compact->utf8 != data);
         }
         else {
+#ifndef NDEBUG
             PyUnicodeObject *unicode = (PyUnicodeObject *)op;
 
             data = unicode->data.any;
+#endif
             if (kind == PyUnicode_WCHAR_KIND) {
                 _PyObject_ASSERT(op, ascii->length == 0);
                 _PyObject_ASSERT(op, ascii->hash == -1);
index 3e56e788b0079b5f70b4c46cd7e6a9b5f6123c47..d859648411fa3f6452caf400a39fb68f56625b0a 100644 (file)
@@ -255,8 +255,8 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
        than +255 (encoded as multiple bytes), just to keep the peephole optimizer
        simple. The optimizer leaves line number deltas unchanged. */
 
-    for (j = 0; j < tabsiz; j += 2) {
-        if (lnotab[j] == 255) {
+    for (i = 0; i < tabsiz; i += 2) {
+        if (lnotab[i] == 255) {
             goto exitUnchanged;
         }
     }
index 5dc7c9613796e0cc847a8677d61523f12f3d7fdf..9d34f71a2e9cf3e33f4fdd8d7185a1a7d7746068 100644 (file)
@@ -57,7 +57,7 @@ static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen,
     }
     resultlen += arglen * 2;
 
-    if (abs_bytes_per_sep >= arglen) {
+    if ((size_t)abs_bytes_per_sep >= (size_t)arglen) {
         bytes_per_sep_group = 0;
         abs_bytes_per_sep = 0;
     }