__hash__ may now return long int; the final hash
  value is obtained by invoking hash on the long int.
Fixes #1536021.
diff --git a/Objects/typeobject.c b/Objects/typeobject.c
index 67e6104..652009b 100644
--- a/Objects/typeobject.c
+++ b/Objects/typeobject.c
@@ -4559,7 +4559,10 @@
 		Py_DECREF(func);
 		if (res == NULL)
 			return -1;
-		h = PyInt_AsLong(res);
+		if (PyLong_Check(res))
+			h = res->ob_type->tp_hash(res);
+		else
+			h = PyInt_AsLong(res);
 		Py_DECREF(res);
 	}
 	else {