test/Scripts/macho-dump: Make hack for Python-2.4. [PR7995]
authorNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 29 Oct 2010 01:14:16 +0000 (01:14 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Fri, 29 Oct 2010 01:14:16 +0000 (01:14 +0000)
With Python-2.4, Reader::read64 always returns (unexpected) long integer.
FileCheck detects failure on test/MC/MachO among '0' and '0L'.

CentOS5(aka RHEL5 clone) provides python-2.4.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@117637 91177308-0d34-0410-b5e6-96231b3b80d8

test/Scripts/macho-dump

index afef2ba5043c503038c7978989aa3fc9183d7dca..8c9fa59c601060815b6a56c14fd40e31b789aae5 100755 (executable)
@@ -43,7 +43,10 @@ class Reader:
       return int(Value)
 
    def read64(self):
-      return struct.unpack('><'[self.isLSB] + 'Q', self.read(8))[0]
+      Value = struct.unpack('><'[self.isLSB] + 'Q', self.read(8))[0]
+      if Value == int(Value):
+         Value = int(Value)
+      return Value
 
    def registerStringTable(self, strings):
       if self.string_table is not None: