[lit] Use py2&3 compatible exec() syntax.
authorDaniel Dunbar <daniel@zuster.org>
Wed, 7 Aug 2013 03:25:28 +0000 (03:25 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Wed, 7 Aug 2013 03:25:28 +0000 (03:25 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@187862 91177308-0d34-0410-b5e6-96231b3b80d8

utils/lit/lit/TestingConfig.py

index 25168d751b63dd08b0212caef4b0c8243cbcd76b..f4ff89f1cdb4777bd935fb985ee208ea83298298 100644 (file)
@@ -1,6 +1,8 @@
 import os
 import sys
 
+PY2 = sys.version_info[0] < 3
+
 class TestingConfig:
     """"
     TestingConfig - Information on the tests inside a suite.
@@ -59,7 +61,11 @@ class TestingConfig:
             cfg_globals['lit'] = litConfig
             cfg_globals['__file__'] = path
             try:
-                exec f in cfg_globals
+                data = f.read()
+                if PY2:
+                    exec("exec data in cfg_globals")
+                else:
+                    exec(data, cfg_globals)
                 if litConfig.debug:
                     litConfig.note('... loaded config %r' % path)
             except SystemExit: