This fixes a unittest failure on 32 bit systems. A recently added
unittest for ht.TJobId uses a rather large number (2347625220). On 64
bit systems it is stored as “int”. On 32 bit systems however, Python
uses “long”. The two types can be intermixed in Python as the
interpreter will take care of conversions. If one processed too many
jobs (2**31) on a 32 bit system, ht would no longer accept the job IDs.

Signed-off-by: Michael Hanselmann <[email protected]>
---
 lib/ht.py |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/ht.py b/lib/ht.py
index d5ae544..935f4ed 100644
--- a/lib/ht.py
+++ b/lib/ht.py
@@ -161,7 +161,7 @@ def TInt(val):
   #
   # >>> (isinstance(False, int), isinstance(True, int))
   # (True, True)
-  return isinstance(val, int) and not isinstance(val, bool)
+  return isinstance(val, (int, long)) and not isinstance(val, bool)
 
 
 @WithDesc("Float")
-- 
1.7.3.5

Reply via email to