8000 [3.8] Fix unused variable and signed/unsigned warnings (GH-15537) by miss-islington · Pull Request #15551 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

[3.8] Fix unused variable and signed/unsigned warnings (GH-15537) #15551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Fix unused variable and signed/unsigned warnings (GH-15537)
(cherry picked from commit 0138c4c)

Co-authored-by: Raymond Hettinger <rhettinger@users.noreply.github.com>
  • Loading branch information
rhettinger authored and miss-islington committed Aug 27, 2019
commit 2892eef775aa1be9ba75a044669b9b72f47eae24
6 changes: 6 additions & 0 deletions Objects/unicodeobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions Python/peephole.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Python/pystrhex.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
0