diff options
author | Zachary Turner <zturner@google.com> | 2017-09-16 00:43:16 +0000 |
---|---|---|
committer | Zachary Turner <zturner@google.com> | 2017-09-16 00:43:16 +0000 |
commit | 493ab405d6b7f1156c73cc16eb6f6e6544b03d2c (patch) | |
tree | 74ed62ce06fbf21092fb828d3eebf48eaaf806fc /utils/lit | |
parent | d9b70ae44ff500ebf3cab5bf645394213f6908e5 (diff) |
[lit] Fix another Python 3 error.
Apparently we have a buildbot running Python 3. This is going
to be fun :-/
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@313428 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/lit')
-rw-r--r-- | utils/lit/lit/util.py | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/utils/lit/lit/util.py b/utils/lit/lit/util.py index 7f3fcc8079a..c36dd589246 100644 --- a/utils/lit/lit/util.py +++ b/utils/lit/lit/util.py @@ -11,13 +11,20 @@ import threading def pythonize_bool(value): + def is_string(value): + try: + # Python 2 and Python 3 are different here. + return isinstance(value, basestring) + except NameError: + return isinstance(value, str) + if value is None: return False if type(value) is bool: return value if isinstance(value, numbers.Number): return value != 0 - if isinstance(value, basestring): + if is_string(value): if value.lower() in ('1', 'true', 'on', 'yes'): return True if value.lower() in ('', '0', 'false', 'off', 'no'): |