[PATCH] D67817: [LNT] Python 3 support: adapt to map returning a view

Thomas Preud'homme via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Sep 23 05:29:08 PDT 2019


thopre marked an inline comment as done.
thopre added inline comments.


================
Comment at: lnt/external/stats/stats.py:1568-1571
+    tmp = list(map(N.array, lists))
+    means = list(map(amean, tmp))
+    vars = list(map(avar, tmp))
+    ns = list(map(len, lists))
----------------
These do not seem to be used later in the function, how can I check if these are global variables?


================
Comment at: lnt/server/db/migrate.py:83
             # Check the version numbers for validity.
-            version, next_version = map(int, m.groups())
+            version, next_version = list(map(int, m.groups()))
             if next_version != version + 1:
----------------
hubert.reinterpretcast wrote:
> The unpacking works fine without the change even with Python 3.
Indeed, https://docs.python.org/3/reference/simple_stmts.html#grammar-token-assignment-stmt says:

Assignment of an object to a target list, optionally enclosed in parentheses or square brackets, is recursively defined as follows.

  -     If the target list is a single target with no trailing comma, optionally in parentheses, the object is assigned to that target.

  -     Else: The object must be an **iterable** with the same number of items as there are targets in the target list, and the items are assigned, from left to right, to the corresponding targets.


================
Comment at: lnt/testing/__init__.py:383
         """
-        self.data.extend(list(map(conv_f, new_samples)))
+        self.data.extend(map(conv_f, new_samples))
 
----------------
Undoing useless change I made just before committing https://reviews.llvm.org/D65751


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

https://reviews.llvm.org/D67817





More information about the llvm-commits mailing list