]> granicus.if.org Git - python/commitdiff
bpo-31849: Fix warning in pyhash.c (GH-6799)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Mon, 4 Jun 2018 17:14:26 +0000 (10:14 -0700)
committerGitHub <noreply@github.com>
Mon, 4 Jun 2018 17:14:26 +0000 (10:14 -0700)
(cherry picked from commit a8eb58546b37a7cd5f332f019bb07388f5212c2d)

Co-authored-by: A. Jesse Jiryu Davis <jesse@emptysquare.net>
Misc/NEWS.d/next/Core and Builtins/2018-05-14-11-00-00.bpo-31849.EmHaH4.rst [new file with mode: 0644]
Python/pyhash.c

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 (file)
index 0000000..876a3cf
--- /dev/null
@@ -0,0 +1 @@
+Fix signed/unsigned comparison warning in pyhash.c.
index a8570740565e92d151f6a155a8072735d33c70a1..13f6da10b1408c320fc4de846836ff653006e920 100644 (file)
@@ -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;
 }