]> granicus.if.org Git - python/commitdiff
-1 is reserved for errors
authorBenjamin Peterson <benjamin@python.org>
Sun, 17 Oct 2010 21:27:01 +0000 (21:27 +0000)
committerBenjamin Peterson <benjamin@python.org>
Sun, 17 Oct 2010 21:27:01 +0000 (21:27 +0000)
Objects/typeobject.c

index a3905d84c709dc53c6e2e90a0865cb679f90e5d6..2c1bf88db81f83824203c0dda5a1b91e31a50978 100644 (file)
@@ -4959,6 +4959,9 @@ slot_tp_hash(PyObject *self)
         PyErr_Clear();
         h = PyLong_Type.tp_hash(res);
     }
+    /* -1 is reserved for errors. */
+    if (h == -1)
+        h = -2;
     Py_DECREF(res);
     return h;
 }