Skip to content

Commit d5ba8bb

Browse files
Fix unused variable and signed/unsigned warnings (GH-15537) (GH-15551)
(cherry picked from commit 0138c4c) Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
1 parent 91020fa commit d5ba8bb

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Objects/unicodeobject.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,10 +456,14 @@ _PyUnicode_CheckConsistency(PyObject *op, int check_content)
456456
}
457457
else {
458458
PyCompactUnicodeObject *compact = (PyCompactUnicodeObject *)op;
459+
#ifndef NDEBUG
459460
void *data;
461+
#endif
460462

461463
if (ascii->state.compact == 1) {
464+
#ifndef NDEBUG
462465
data = compact + 1;
466+
#endif
463467
_PyObject_ASSERT(op, kind == PyUnicode_1BYTE_KIND
464468
|| kind == PyUnicode_2BYTE_KIND
465469
|| kind == PyUnicode_4BYTE_KIND);
@@ -468,9 +472,11 @@ _PyUnicode_CheckConsistency(PyObject *op, int check_content)
468472
_PyObject_ASSERT(op, compact->utf8 != data);
469473
}
470474
else {
475+
#ifndef NDEBUG
471476
PyUnicodeObject *unicode = (PyUnicodeObject *)op;
472477

473478
data = unicode->data.any;
479+
#endif
474480
if (kind == PyUnicode_WCHAR_KIND) {
475481
_PyObject_ASSERT(op, ascii->length == 0);
476482
_PyObject_ASSERT(op, ascii->hash == -1);

Python/peephole.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,8 +255,8 @@ PyCode_Optimize(PyObject *code, PyObject* consts, PyObject *names,
255255
than +255 (encoded as multiple bytes), just to keep the peephole optimizer
256256
simple. The optimizer leaves line number deltas unchanged. */
257257

258-
for (j = 0; j < tabsiz; j += 2) {
259-
if (lnotab[j] == 255) {
258+
for (i = 0; i < tabsiz; i += 2) {
259+
if (lnotab[i] == 255) {
260260
goto exitUnchanged;
261261
}
262262
}

Python/pystrhex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ static PyObject *_Py_strhex_impl(const char* argbuf, const Py_ssize_t arglen,
5757
}
5858
resultlen += arglen * 2;
5959

60-
if (abs_bytes_per_sep >= arglen) {
60+
if ((size_t)abs_bytes_per_sep >= (size_t)arglen) {
6161
bytes_per_sep_group = 0;
6262
abs_bytes_per_sep = 0;
6363
}

0 commit comments

Comments
 (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