8000 Fix unused variable and signed/unsigned warnings (GH-15537) · python/cpython@0138c4c · GitHub
[go: up one dir, main page]

Skip to content

Commit 0138c4c

Browse files
authored
Fix unused variable and signed/unsigned warnings (GH-15537)
1 parent 8bf5fef commit 0138c4c

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
@@ -500,10 +500,14 @@ _PyUnicode_CheckConsistency(PyObject *op, int check_content)
500500
}
501501
else {
502502
PyCompactUnicodeObject *compact = (PyCompactUnicodeObject *)op;
503+
#ifndef NDEBUG
503504
void *data;
505+
#endif
504506

505507
if (ascii->state.compact == 1) {
508+
#ifndef NDEBUG
506509
data = compact + 1;
510+
#endif
507511
_PyObject_ASSERT(op, kind == PyUnicode_1BYTE_KIND
508512
|| kind == PyUnicode_2BYTE_KIND
509513
|| kind == PyUnicode_4BYTE_KIND);
@@ -512,9 +516,11 @@ _PyUnicode_CheckConsistency(PyObject *op, int check_content)
512516
_PyObject_ASSERT(op, compact->utf8 != data);
513517
}
514518
else {
519+
#ifndef NDEBUG
515520
PyUnicodeObject *unicode = (PyUnicodeObject *)op;
516521

517522
data = unicode->data.any;
523+
#endif
518524
if (kind == PyUnicode_WCHAR_KIND) {
519525
_PyObject_ASSERT(op, ascii->length == 0);
520526
_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)
0