diff options
author | Matthias Braun <matze@braunis.de> | 2016-03-31 23:08:55 +0000 |
---|---|---|
committer | Matthias Braun <matze@braunis.de> | 2016-03-31 23:08:55 +0000 |
commit | 19832b616e7762b2f13437654abfbca011eb970f (patch) | |
tree | 41ebe2fce0c706f0c8ac5ee9c9f7acbe8e7502f6 /llvm/utils | |
parent | acff7d4a25a572668a2597ab9ded798eb58a8f4a (diff) | |
download | bcm5719-llvm-19832b616e7762b2f13437654abfbca011eb970f.tar.gz bcm5719-llvm-19832b616e7762b2f13437654abfbca011eb970f.zip |
lit: python3 compatibility fix
llvm-svn: 265070
Diffstat (limited to 'llvm/utils')
-rw-r--r-- | llvm/utils/lit/lit/Test.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/utils/lit/lit/Test.py b/llvm/utils/lit/lit/Test.py index c7c54897f00..9c9c47d6321 100644 --- a/llvm/utils/lit/lit/Test.py +++ b/llvm/utils/lit/lit/Test.py @@ -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) |