From 2892eef775aa1be9ba75a044669b9b72f47eae24 Mon Sep 17 00:00:00 2001 From: Raymond Hettinger Date: Tue, 27 Aug 2019 09:55:13 -0700 Subject: [PATCH] Fix unused variable and signed/unsigned warnings (GH-15537) (cherry picked from commit 0138c4ceab1e10d42d0aa962d2ae079b46da7671) Co-authored-by: Raymond Hettinger --- Objects/unicodeobject.c | 6 ++++++ Python/peephole.c | 4 ++-- Python/pystrhex.c | 2 +- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c index c28f36fb4618b5..8521a4c9d7de56 100644 --- a/Objects/unicodeobject.c +++ b/Objects/unicodeobject.c @@ -456,10 +456,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); @@ -468,9 +472,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); diff --git a/Python/peephole.c b/Python/peephole.c index 3e56e788b0079b..d859648411fa3f 100644 --- a/Python/peephole.c +++ b/Python/peephole.c @@ -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; } } diff --git a/Python/pystrhex.c b/Python/pystrhex.c index 5dc7c9613796e0..9d34f71a2e9cf3 100644 --- a/Python/pystrhex.c +++ b/Python/pystrhex.c @@ -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; } pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy