[llvm] r313428 - [lit] Fix another Python 3 error.
Zachary Turner via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 15 17:43:16 PDT 2017
Author: zturner
Date: Fri Sep 15 17:43:16 2017
New Revision: 313428
URL: http://llvm.org/viewvc/llvm-project?rev=313428&view=rev
Log:
[lit] Fix another Python 3 error.
Apparently we have a buildbot running Python 3. This is going
to be fun :-/
Modified:
llvm/trunk/utils/lit/lit/util.py
Modified: llvm/trunk/utils/lit/lit/util.py
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/utils/lit/lit/util.py?rev=313428&r1=313427&r2=313428&view=diff
==============================================================================
--- llvm/trunk/utils/lit/lit/util.py (original)
+++ llvm/trunk/utils/lit/lit/util.py Fri Sep 15 17:43:16 2017
@@ -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'):
More information about the llvm-commits
mailing list