[Python-checkins] bpo-31849: Fix warning in pyhash.c (GH-6799)

Miss Islington (bot) webhook-mailer at python.org
Mon Jun 4 13:14:30 EDT 2018


https://github.com/python/cpython/commit/4251d2a3540bf7a23949c7fafad64b796585674a
commit: 4251d2a3540bf7a23949c7fafad64b796585674a
branch: 3.6
author: Miss Islington (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2018-06-04T10:14:26-07:00
summary:

bpo-31849: Fix warning in pyhash.c (GH-6799)

(cherry picked from commit a8eb58546b37a7cd5f332f019bb07388f5212c2d)

Co-authored-by: A. Jesse Jiryu Davis <jesse at emptysquare.net>

files:
A Misc/NEWS.d/next/Core and Builtins/2018-05-14-11-00-00.bpo-31849.EmHaH4.rst
M 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
index 000000000000..876a3cf0aa13
--- /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 a8570740565e..13f6da10b140 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;
 }



More information about the Python-checkins mailing list