On Python 2, the builtin functions filter() and zip() would return
lists.

On Python 3, they return iterators.

Since we want to use those objects in contexts where we need lists, we
need to explicitly turn them into lists.

This makes the code compatible with both Python 2 and Python 3.

Signed-off-by: Mathieu Bridon <[email protected]>
---
 src/compiler/nir/nir_opt_algebraic.py | 2 +-
 src/mesa/main/get_hash_generator.py   | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 5e07d662b0..7b2ba56990 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -633,7 +633,7 @@ optimizations = [
 
 invert = OrderedDict([('feq', 'fne'), ('fne', 'feq'), ('fge', 'flt'), ('flt', 
'fge')])
 
-for left, right in list(itertools.combinations(invert.keys(), 2)) + 
zip(invert.keys(), invert.keys()):
+for left, right in list(itertools.combinations(invert.keys(), 2)) + 
list(zip(invert.keys(), invert.keys())):
    optimizations.append((('inot', ('ior(is_used_once)', (left, a, b), (right, 
c, d))),
                          ('iand', (invert[left], a, b), (invert[right], c, 
d))))
    optimizations.append((('inot', ('iand(is_used_once)', (left, a, b), (right, 
c, d))),
diff --git a/src/mesa/main/get_hash_generator.py 
b/src/mesa/main/get_hash_generator.py
index facdccd8a5..37dae45e0b 100644
--- a/src/mesa/main/get_hash_generator.py
+++ b/src/mesa/main/get_hash_generator.py
@@ -117,8 +117,8 @@ def print_tables(tables):
 def merge_tables(tables):
    merged_tables = []
    for api, indices in sorted(tables.items()):
-      matching_table = filter(lambda mt:mt["indices"] == indices,
-                              merged_tables)
+      matching_table = list(filter(lambda mt:mt["indices"] == indices,
+                              merged_tables))
       if matching_table:
          matching_table[0]["apis"].append(api)
       else:
-- 
2.17.1

_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to