From 27f0b2918832c82d191e06e524df144755a3418c Mon Sep 17 00:00:00 2001 From: Dan Gohman Date: Fri, 1 Dec 2017 06:32:38 -0800 Subject: [PATCH] Replace `hex` with `"0x%x" % ...` to fix a trailing 'L' on 32-bit python2 This test was failing because the hash computes values greater than 0x7fffffff, which 32-bit python2 promotes to long, which `hex` formats with a trailing 'L'. The code that uses it appears to be ok with a long value, so it's just the test that needs to handle it. Fix as suggested here: https://stackoverflow.com/questions/5917203/python-trailing-l-problem --- lib/cretonne/meta/constant_hash.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/cretonne/meta/constant_hash.py b/lib/cretonne/meta/constant_hash.py index 47f5eebe33..9ef19ff098 100644 --- a/lib/cretonne/meta/constant_hash.py +++ b/lib/cretonne/meta/constant_hash.py @@ -20,9 +20,9 @@ def simple_hash(s): Compute a primitive hash of a string. Example: - >>> hex(simple_hash("Hello")) + >>> "0x%x" % simple_hash("Hello") '0x2fa70c01' - >>> hex(simple_hash("world")) + >>> "0x%x" % simple_hash("world") '0x5b0c31d5' """ h = 5381