[PATCH] D67534: [LNT] Python 3 support: Minor automatic 2to3 fixups

Hubert Tong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 13 06:43:09 PDT 2019


hubert.reinterpretcast updated this revision to Diff 220094.
hubert.reinterpretcast marked an inline comment as done.
hubert.reinterpretcast added a comment.

- Update `exec` call to have a string argument


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D67534/new/

https://reviews.llvm.org/D67534

Files:
  lnt/formats/__init__.py
  lnt/lnttool/create.py
  lnt/server/instance.py
  lnt/testing/__init__.py


Index: lnt/testing/__init__.py
===================================================================
--- lnt/testing/__init__.py
+++ lnt/testing/__init__.py
@@ -182,7 +182,7 @@
         self.name = str(name)
         self.info = dict((str(key), str(value))
                          for key, value in info.items())
-        self.data = map(conv_f, data)
+        self.data = list(map(conv_f, data))
 
     def render(self):
         """Return info from this instance in a dictionary that respects
Index: lnt/server/instance.py
===================================================================
--- lnt/server/instance.py
+++ lnt/server/instance.py
@@ -54,7 +54,7 @@
             raise Exception("Invalid config: %r" % config_path)
 
         config_data = {}
-        exec open(config_path) in config_data
+        exec(open(config_path).read(), config_data)
         config = lnt.server.config.Config.from_data(config_path, config_data)
 
         return Instance(config_path, config, tmpdir)
Index: lnt/lnttool/create.py
===================================================================
--- lnt/lnttool/create.py
+++ lnt/lnttool/create.py
@@ -159,7 +159,7 @@
     wsgi_file = open(wsgi_path, 'w')
     wsgi_file.write(kWSGITemplate % locals())
     wsgi_file.close()
-    os.chmod(wsgi_path, 0755)
+    os.chmod(wsgi_path, 0o755)
 
     # Execute an upgrade on the database to initialize the schema.
     lnt.server.db.migrate.update_path(db_path)
Index: lnt/formats/__init__.py
===================================================================
--- lnt/formats/__init__.py
+++ lnt/formats/__init__.py
@@ -12,7 +12,7 @@
 
 formats = [plist, json]
 formats_by_name = dict((f['name'], f) for f in formats)
-format_names = formats_by_name.keys()
+format_names = list(formats_by_name.keys())
 
 
 def get_format(name):


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67534.220094.patch
Type: text/x-patch
Size: 1819 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190913/debf3591/attachment.bin>


More information about the llvm-commits mailing list