From 9948d5538b8c400aec0dc23c545ec5094f8e079b Mon Sep 17 00:00:00 2001 From: Josh Morton Date: Thu, 10 Jan 2019 12:26:52 -0800 Subject: [PATCH] Wrap invocation of dict.items() in list(). (#91) Some infrastructure parses bzl files as python, which fails when dict.items() returns a special dict_items generator instead of a list in python3. --- lib/collections.bzl | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/collections.bzl b/lib/collections.bzl index de612ff..f41eea2 100644 --- a/lib/collections.bzl +++ b/lib/collections.bzl @@ -60,7 +60,10 @@ def _uniq(iterable): A new list with all unique elements from `iterable`. """ unique_elements = {element: None for element in iterable} - return unique_elements.keys() + + # list() used here for python3 compatibility. + # TODO(bazel-team): Remove when testing frameworks no longer require python compatibility. + return list(unique_elements.keys()) collections = struct( after_each = _after_each,