[llvm] r265070 - lit: python3 compatibility fix

Matthias Braun via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 31 16:08:56 PDT 2016


Author: matze
Date: Thu Mar 31 18:08:55 2016
New Revision: 265070

URL: http://llvm.org/viewvc/llvm-project?rev=265070&view=rev
Log:
lit: python3 compatibility fix

Modified:
    llvm/trunk/utils/lit/lit/Test.py

Modified: llvm/trunk/utils/lit/lit/Test.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/Test.py?rev=265070&r1=265069&r2=265070&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/Test.py (original)
+++ llvm/trunk/utils/lit/lit/Test.py Thu Mar 31 18:08:55 2016
@@ -102,11 +102,18 @@ class JSONMetricValue(MetricValue):
 def toMetricValue(value):
     if isinstance(value, MetricValue):
         return value
-    elif isinstance(value, int) or isinstance(value, long):
+    elif isinstance(value, int):
         return IntMetricValue(value)
     elif isinstance(value, float):
         return RealMetricValue(value)
     else:
+        # 'long' is only present in python2
+        try:
+            if isinstance(value, long):
+                return IntMetricValue(value)
+        except NameError:
+            pass
+
         # Try to create a JSONMetricValue and let the constructor throw
         # if value is not a valid type.
         return JSONMetricValue(value)




More information about the llvm-commits mailing list