1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-18 18:42:46 +02:00

lit: python3 compatibility fix

llvm-svn: 265070
This commit is contained in:
Matthias Braun 2016-03-31 23:08:55 +00:00
parent 9d806ba01a
commit 10c7f27ee3

View File

@ -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)