mirror of
https://github.com/RPCSX/llvm.git
synced 2025-04-13 05:20:27 +00:00
lit: python3 compatibility fix
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@265070 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
7f4c23bbda
commit
44f51d9b56
@ -102,11 +102,18 @@ class JSONMetricValue(MetricValue):
|
|||||||
def toMetricValue(value):
|
def toMetricValue(value):
|
||||||
if isinstance(value, MetricValue):
|
if isinstance(value, MetricValue):
|
||||||
return value
|
return value
|
||||||
elif isinstance(value, int) or isinstance(value, long):
|
elif isinstance(value, int):
|
||||||
return IntMetricValue(value)
|
return IntMetricValue(value)
|
||||||
elif isinstance(value, float):
|
elif isinstance(value, float):
|
||||||
return RealMetricValue(value)
|
return RealMetricValue(value)
|
||||||
else:
|
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
|
# Try to create a JSONMetricValue and let the constructor throw
|
||||||
# if value is not a valid type.
|
# if value is not a valid type.
|
||||||
return JSONMetricValue(value)
|
return JSONMetricValue(value)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user