From: Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> Date: Mon, 4 Jun 2018 17:31:07 +0000 (-0700) Subject: bpo-31849: Fix warning in pyhash.c (GH-6799) X-Git-Tag: v3.7.0rc1~75 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=150033d1599f55c10860a733d370707a3f7c444e;p=python bpo-31849: Fix warning in pyhash.c (GH-6799) (cherry picked from commit a8eb58546b37a7cd5f332f019bb07388f5212c2d) Co-authored-by: A. Jesse Jiryu Davis --- diff --git a/Misc/NEWS.d/next/Core and Builtins/2018-05-14-11-00-00.bpo-31849.EmHaH4.rst b/Misc/NEWS.d/next/Core and Builtins/2018-05-14-11-00-00.bpo-31849.EmHaH4.rst new file mode 100644 index 0000000000..876a3cf0aa --- /dev/null +++ b/Misc/NEWS.d/next/Core and Builtins/2018-05-14-11-00-00.bpo-31849.EmHaH4.rst @@ -0,0 +1 @@ +Fix signed/unsigned comparison warning in pyhash.c. diff --git a/Python/pyhash.c b/Python/pyhash.c index 6fc12fde3f..4c0b929586 100644 --- a/Python/pyhash.c +++ b/Python/pyhash.c @@ -272,8 +272,8 @@ fnv(const void *src, Py_ssize_t len) x = (_PyHASH_MULTIPLIER * x) ^ (Py_uhash_t) *p++; x ^= (Py_uhash_t) len; x ^= (Py_uhash_t) _Py_HashSecret.fnv.suffix; - if (x == -1) { - x = -2; + if (x == (Py_uhash_t) -1) { + x = (Py_uhash_t) -2; } return x; }