[PATCH] D25400: [lit] Remove Python 2.6 and below exec workaround

Brian Gesiak via llvm-commits llvm-commits at lists.llvm.org
Sat Oct 8 12:46:01 PDT 2016


modocache created this revision.
modocache added reviewers: ddunbar, echristo, delcypher, beanz.
modocache added a subscriber: llvm-commits.
Herald added a subscriber: mehdi_amini.

The minimum version of Python required to run LLVM's test suite is 2.7.
Remove a workaround for older Python versions.


https://reviews.llvm.org/D25400

Files:
  utils/lit/lit/TestingConfig.py


Index: utils/lit/lit/TestingConfig.py
===================================================================
--- utils/lit/lit/TestingConfig.py
+++ utils/lit/lit/TestingConfig.py
@@ -1,7 +1,6 @@
 import os
 import sys
 
-OldPy = sys.version_info[0] == 2 and sys.version_info[1] < 7
 
 class TestingConfig:
     """"
@@ -73,24 +72,20 @@
 
         # Load the config script data.
         data = None
-        if not OldPy:
-            f = open(path)
-            try:
-                data = f.read()
-            except:
-                litConfig.fatal('unable to load config file: %r' % (path,))
-            f.close()
+        f = open(path)
+        try:
+            data = f.read()
+        except:
+            litConfig.fatal('unable to load config file: %r' % (path,))
+        f.close()
 
         # Execute the config script to initialize the object.
         cfg_globals = dict(globals())
         cfg_globals['config'] = self
         cfg_globals['lit_config'] = litConfig
         cfg_globals['__file__'] = path
         try:
-            if OldPy:
-                execfile(path, cfg_globals)
-            else:
-                exec(compile(data, path, 'exec'), cfg_globals, None)
+            exec(compile(data, path, 'exec'), cfg_globals, None)
             if litConfig.debug:
                 litConfig.note('... loaded config %r' % path)
         except SystemExit:


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D25400.74043.patch
Type: text/x-patch
Size: 1385 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20161008/2e3abdda/attachment.bin>


More information about the llvm-commits mailing list