Module: Mesa
Branch: master
Commit: c644b2d7a7602e929b92dd2c52ed2765928e02b1
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c644b2d7a7602e929b92dd2c52ed2765928e02b1

Author: Mathieu Bridon <[email protected]>
Date:   Thu Aug  9 10:27:20 2018 +0200

python: Explicitly use a list

On Python 2, the builtin functions filter() returns a list.

On Python 3, it returns an iterator.

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]>
Reviewed-by: Dylan Baker <[email protected]>

---

 src/mesa/main/get_hash_generator.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

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:

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

Reply via email to